Vectorize sad tab image.
[chromium-blink-merge.git] / chrome / browser / ui / global_error / global_error.cc
blobfb6af0fd01e818f3e10aa5c6c957553679286cae
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"
18 #endif
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);
32 #else
33 SkColor icon_color;
34 ui::CommonThemeGetSystemColor(ui::NativeTheme::kColorId_Amber, &icon_color);
35 return gfx::Image(
36 gfx::CreateVectorIcon(gfx::VectorIconId::WARNING, 18, icon_color));
37 #endif
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 bubble_view_ =
56 GlobalErrorBubbleViewBase::ShowStandardBubbleView(browser, AsWeakPtr());
59 GlobalErrorBubbleViewBase* GlobalErrorWithStandardBubble::GetBubbleView() {
60 return bubble_view_;
63 bool GlobalErrorWithStandardBubble::ShouldCloseOnDeactivate() const {
64 return true;
67 gfx::Image GlobalErrorWithStandardBubble::GetBubbleViewIcon() {
68 // If you change this make sure to also change the menu icon and the wrench
69 // icon color.
70 return ResourceBundle::GetSharedInstance().GetNativeImageNamed(
71 IDR_INPUT_ALERT);
74 bool GlobalErrorWithStandardBubble::ShouldShowCloseButton() const {
75 return false;
78 bool GlobalErrorWithStandardBubble::ShouldAddElevationIconToAcceptButton() {
79 return false;
82 void GlobalErrorWithStandardBubble::BubbleViewDidClose(Browser* browser) {
83 DCHECK(browser);
84 bubble_view_ = NULL;
85 OnBubbleViewDidClose(browser);