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/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 else | 140 else |
141 NOTREACHED(); | 141 NOTREACHED(); |
142 } | 142 } |
143 | 143 |
144 void InvertBubbleView::OpenLink(const std::string& url, int event_flags) { | 144 void InvertBubbleView::OpenLink(const std::string& url, int event_flags) { |
145 WindowOpenDisposition disposition = | 145 WindowOpenDisposition disposition = |
146 ui::DispositionFromEventFlags(event_flags); | 146 ui::DispositionFromEventFlags(event_flags); |
147 content::OpenURLParams params( | 147 content::OpenURLParams params( |
148 GURL(url), content::Referrer(), | 148 GURL(url), content::Referrer(), |
149 disposition == CURRENT_TAB ? NEW_FOREGROUND_TAB : disposition, | 149 disposition == CURRENT_TAB ? NEW_FOREGROUND_TAB : disposition, |
150 content::PAGE_TRANSITION_LINK, false); | 150 ui::PAGE_TRANSITION_LINK, false); |
151 browser_->OpenURL(params); | 151 browser_->OpenURL(params); |
152 } | 152 } |
153 | 153 |
154 } // namespace | 154 } // namespace |
155 | 155 |
156 namespace chrome { | 156 namespace chrome { |
157 | 157 |
158 void MaybeShowInvertBubbleView(BrowserView* browser_view) { | 158 void MaybeShowInvertBubbleView(BrowserView* browser_view) { |
159 Browser* browser = browser_view->browser(); | 159 Browser* browser = browser_view->browser(); |
160 PrefService* pref_service = browser->profile()->GetPrefs(); | 160 PrefService* pref_service = browser->profile()->GetPrefs(); |
161 views::View* anchor = browser_view->toolbar()->app_menu(); | 161 views::View* anchor = browser_view->toolbar()->app_menu(); |
162 if (gfx::IsInvertedColorScheme() && anchor && anchor->GetWidget() && | 162 if (gfx::IsInvertedColorScheme() && anchor && anchor->GetWidget() && |
163 !pref_service->GetBoolean(prefs::kInvertNotificationShown)) { | 163 !pref_service->GetBoolean(prefs::kInvertNotificationShown)) { |
164 pref_service->SetBoolean(prefs::kInvertNotificationShown, true); | 164 pref_service->SetBoolean(prefs::kInvertNotificationShown, true); |
165 InvertBubbleView* delegate = new InvertBubbleView(browser, anchor); | 165 InvertBubbleView* delegate = new InvertBubbleView(browser, anchor); |
166 views::BubbleDelegateView::CreateBubble(delegate)->Show(); | 166 views::BubbleDelegateView::CreateBubble(delegate)->Show(); |
167 } | 167 } |
168 } | 168 } |
169 | 169 |
170 } // namespace chrome | 170 } // namespace chrome |
OLD | NEW |