| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/views/accessibility/invert_bubble_view.h" | 5 #include "chrome/browser/ui/views/accessibility/invert_bubble_view.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/browser/ui/browser_dialogs.h" |
| 10 #include "chrome/browser/ui/views/frame/browser_view.h" | 11 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 11 #include "chrome/browser/ui/views/toolbar/app_menu_button.h" | 12 #include "chrome/browser/ui/views/toolbar/app_menu_button.h" |
| 12 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" | 13 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" |
| 13 #include "chrome/common/pref_names.h" | 14 #include "chrome/common/pref_names.h" |
| 14 #include "chrome/grit/generated_resources.h" | 15 #include "chrome/grit/generated_resources.h" |
| 15 #include "components/prefs/pref_service.h" | 16 #include "components/prefs/pref_service.h" |
| 16 #include "components/strings/grit/components_strings.h" | 17 #include "components/strings/grit/components_strings.h" |
| 17 #include "content/public/browser/page_navigator.h" | 18 #include "content/public/browser/page_navigator.h" |
| 18 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
| 19 #include "ui/base/resource/resource_bundle.h" | 20 #include "ui/base/resource/resource_bundle.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 DISALLOW_COPY_AND_ASSIGN(InvertBubbleView); | 62 DISALLOW_COPY_AND_ASSIGN(InvertBubbleView); |
| 62 }; | 63 }; |
| 63 | 64 |
| 64 InvertBubbleView::InvertBubbleView(Browser* browser, views::View* anchor_view) | 65 InvertBubbleView::InvertBubbleView(Browser* browser, views::View* anchor_view) |
| 65 : views::BubbleDialogDelegateView(anchor_view, | 66 : views::BubbleDialogDelegateView(anchor_view, |
| 66 views::BubbleBorder::TOP_RIGHT), | 67 views::BubbleBorder::TOP_RIGHT), |
| 67 browser_(browser), | 68 browser_(browser), |
| 68 high_contrast_(NULL), | 69 high_contrast_(NULL), |
| 69 dark_theme_(NULL), | 70 dark_theme_(NULL), |
| 70 learn_more_(NULL), | 71 learn_more_(NULL), |
| 71 close_(NULL) {} | 72 close_(NULL) { |
| 73 chrome::RecordDialogCreation(chrome::DialogIdentifier::INVERT); |
| 74 } |
| 72 | 75 |
| 73 InvertBubbleView::~InvertBubbleView() { | 76 InvertBubbleView::~InvertBubbleView() { |
| 74 } | 77 } |
| 75 | 78 |
| 76 int InvertBubbleView::GetDialogButtons() const { | 79 int InvertBubbleView::GetDialogButtons() const { |
| 77 return ui::DIALOG_BUTTON_NONE; | 80 return ui::DIALOG_BUTTON_NONE; |
| 78 } | 81 } |
| 79 | 82 |
| 80 void InvertBubbleView::Init() { | 83 void InvertBubbleView::Init() { |
| 81 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 84 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 views::View* anchor = browser_view->toolbar()->app_menu_button(); | 174 views::View* anchor = browser_view->toolbar()->app_menu_button(); |
| 172 if (color_utils::IsInvertedColorScheme() && anchor && anchor->GetWidget() && | 175 if (color_utils::IsInvertedColorScheme() && anchor && anchor->GetWidget() && |
| 173 !pref_service->GetBoolean(prefs::kInvertNotificationShown)) { | 176 !pref_service->GetBoolean(prefs::kInvertNotificationShown)) { |
| 174 pref_service->SetBoolean(prefs::kInvertNotificationShown, true); | 177 pref_service->SetBoolean(prefs::kInvertNotificationShown, true); |
| 175 InvertBubbleView* delegate = new InvertBubbleView(browser, anchor); | 178 InvertBubbleView* delegate = new InvertBubbleView(browser, anchor); |
| 176 views::BubbleDialogDelegateView::CreateBubble(delegate)->Show(); | 179 views::BubbleDialogDelegateView::CreateBubble(delegate)->Show(); |
| 177 } | 180 } |
| 178 } | 181 } |
| 179 | 182 |
| 180 } // namespace chrome | 183 } // namespace chrome |
| OLD | NEW |