Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / global_error / global_error.cc
blobdb052068452e49b3ee1bab57fb17d53883ed17c3
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 // GlobalError ---------------------------------------------------------------
15 GlobalError::GlobalError() {}
17 GlobalError::~GlobalError() {}
19 GlobalError::Severity GlobalError::GetSeverity() { return SEVERITY_MEDIUM; }
21 int GlobalError::MenuItemIconResourceID() {
22 // If you change this make sure to also change the bubble icon and the wrench
23 // icon color.
24 return IDR_INPUT_ALERT_MENU;
27 // GlobalErrorWithStandardBubble ---------------------------------------------
29 GlobalErrorWithStandardBubble::GlobalErrorWithStandardBubble()
30 : has_shown_bubble_view_(false), bubble_view_(NULL) {}
32 GlobalErrorWithStandardBubble::~GlobalErrorWithStandardBubble() {}
34 bool GlobalErrorWithStandardBubble::HasBubbleView() { return true; }
36 bool GlobalErrorWithStandardBubble::HasShownBubbleView() {
37 return has_shown_bubble_view_;
40 void GlobalErrorWithStandardBubble::ShowBubbleView(Browser* browser) {
41 has_shown_bubble_view_ = true;
42 #if defined(OS_ANDROID)
43 // http://crbug.com/136506
44 NOTIMPLEMENTED() << "Chrome for Android doesn't support global errors";
45 #else
46 bubble_view_ =
47 GlobalErrorBubbleViewBase::ShowStandardBubbleView(browser, AsWeakPtr());
48 #endif
51 GlobalErrorBubbleViewBase* GlobalErrorWithStandardBubble::GetBubbleView() {
52 return bubble_view_;
55 gfx::Image GlobalErrorWithStandardBubble::GetBubbleViewIcon() {
56 // If you change this make sure to also change the menu icon and the wrench
57 // icon color.
58 return ResourceBundle::GetSharedInstance().GetNativeImageNamed(
59 IDR_INPUT_ALERT);
62 void GlobalErrorWithStandardBubble::BubbleViewDidClose(Browser* browser) {
63 DCHECK(browser);
64 bubble_view_ = NULL;
65 OnBubbleViewDidClose(browser);