| 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/views/frame/browser_view.h" | 10 #include "chrome/browser/ui/views/frame/browser_view.h" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 GetWidget()->Close(); | 147 GetWidget()->Close(); |
| 148 else | 148 else |
| 149 NOTREACHED(); | 149 NOTREACHED(); |
| 150 } | 150 } |
| 151 | 151 |
| 152 void InvertBubbleView::OpenLink(const std::string& url, int event_flags) { | 152 void InvertBubbleView::OpenLink(const std::string& url, int event_flags) { |
| 153 WindowOpenDisposition disposition = | 153 WindowOpenDisposition disposition = |
| 154 ui::DispositionFromEventFlags(event_flags); | 154 ui::DispositionFromEventFlags(event_flags); |
| 155 content::OpenURLParams params( | 155 content::OpenURLParams params( |
| 156 GURL(url), content::Referrer(), | 156 GURL(url), content::Referrer(), |
| 157 disposition == CURRENT_TAB ? NEW_FOREGROUND_TAB : disposition, | 157 disposition == WindowOpenDisposition::CURRENT_TAB |
| 158 ? WindowOpenDisposition::NEW_FOREGROUND_TAB |
| 159 : disposition, |
| 158 ui::PAGE_TRANSITION_LINK, false); | 160 ui::PAGE_TRANSITION_LINK, false); |
| 159 browser_->OpenURL(params); | 161 browser_->OpenURL(params); |
| 160 } | 162 } |
| 161 | 163 |
| 162 } // namespace | 164 } // namespace |
| 163 | 165 |
| 164 namespace chrome { | 166 namespace chrome { |
| 165 | 167 |
| 166 void MaybeShowInvertBubbleView(BrowserView* browser_view) { | 168 void MaybeShowInvertBubbleView(BrowserView* browser_view) { |
| 167 Browser* browser = browser_view->browser(); | 169 Browser* browser = browser_view->browser(); |
| 168 PrefService* pref_service = browser->profile()->GetPrefs(); | 170 PrefService* pref_service = browser->profile()->GetPrefs(); |
| 169 views::View* anchor = browser_view->toolbar()->app_menu_button(); | 171 views::View* anchor = browser_view->toolbar()->app_menu_button(); |
| 170 if (color_utils::IsInvertedColorScheme() && anchor && anchor->GetWidget() && | 172 if (color_utils::IsInvertedColorScheme() && anchor && anchor->GetWidget() && |
| 171 !pref_service->GetBoolean(prefs::kInvertNotificationShown)) { | 173 !pref_service->GetBoolean(prefs::kInvertNotificationShown)) { |
| 172 pref_service->SetBoolean(prefs::kInvertNotificationShown, true); | 174 pref_service->SetBoolean(prefs::kInvertNotificationShown, true); |
| 173 InvertBubbleView* delegate = new InvertBubbleView(browser, anchor); | 175 InvertBubbleView* delegate = new InvertBubbleView(browser, anchor); |
| 174 views::BubbleDialogDelegateView::CreateBubble(delegate)->Show(); | 176 views::BubbleDialogDelegateView::CreateBubble(delegate)->Show(); |
| 175 } | 177 } |
| 176 } | 178 } |
| 177 | 179 |
| 178 } // namespace chrome | 180 } // namespace chrome |
| OLD | NEW |