1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/global_error/global_error.h"
7 #include "base/logging.h"
8 #include "chrome/browser/ui/global_error/global_error_bubble_view_base.h"
9 #include "grit/theme_resources.h"
10 #include "ui/base/resource/resource_bundle.h"
11 #include "ui/gfx/image/image.h"
13 #if !defined(OS_MACOSX) && !defined(OS_ANDROID)
14 #include "ui/gfx/paint_vector_icon.h"
15 #include "ui/gfx/vector_icons_public.h"
16 #include "ui/native_theme/common_theme.h"
17 #include "ui/native_theme/native_theme.h"
20 // GlobalError ---------------------------------------------------------------
22 GlobalError::GlobalError() {}
24 GlobalError::~GlobalError() {}
26 GlobalError::Severity
GlobalError::GetSeverity() { return SEVERITY_MEDIUM
; }
28 gfx::Image
GlobalError::MenuItemIcon() {
29 #if defined(OS_MACOSX) || defined(OS_ANDROID)
30 return ResourceBundle::GetSharedInstance().GetNativeImageNamed(
31 IDR_INPUT_ALERT_MENU
);
34 ui::CommonThemeGetSystemColor(ui::NativeTheme::kColorId_Amber
, &icon_color
);
36 gfx::CreateVectorIcon(gfx::VectorIconId::WARNING
, 18, icon_color
));
40 // GlobalErrorWithStandardBubble ---------------------------------------------
42 GlobalErrorWithStandardBubble::GlobalErrorWithStandardBubble()
43 : has_shown_bubble_view_(false), bubble_view_(NULL
) {}
45 GlobalErrorWithStandardBubble::~GlobalErrorWithStandardBubble() {}
47 bool GlobalErrorWithStandardBubble::HasBubbleView() { return true; }
49 bool GlobalErrorWithStandardBubble::HasShownBubbleView() {
50 return has_shown_bubble_view_
;
53 void GlobalErrorWithStandardBubble::ShowBubbleView(Browser
* browser
) {
54 has_shown_bubble_view_
= true;
55 #if defined(OS_ANDROID)
56 // http://crbug.com/136506
57 NOTIMPLEMENTED() << "Chrome for Android doesn't support global errors";
60 GlobalErrorBubbleViewBase::ShowStandardBubbleView(browser
, AsWeakPtr());
64 GlobalErrorBubbleViewBase
* GlobalErrorWithStandardBubble::GetBubbleView() {
68 bool GlobalErrorWithStandardBubble::ShouldCloseOnDeactivate() const {
72 gfx::Image
GlobalErrorWithStandardBubble::GetBubbleViewIcon() {
73 // If you change this make sure to also change the menu icon and the wrench
75 return ResourceBundle::GetSharedInstance().GetNativeImageNamed(
79 bool GlobalErrorWithStandardBubble::ShouldShowCloseButton() const {
83 bool GlobalErrorWithStandardBubble::ShouldAddElevationIconToAcceptButton() {
87 void GlobalErrorWithStandardBubble::BubbleViewDidClose(Browser
* browser
) {
90 OnBubbleViewDidClose(browser
);