Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(242)

Side by Side Diff: chrome/browser/accessibility/invert_bubble_views.cc

Issue 10391158: Moves methods for finding browsers to browser_finder. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Include fixs Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/app_controller_mac.mm » ('j') | chrome/browser/ui/browser_finder.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/utf_string_conversions.h" 5 #include "base/utf_string_conversions.h"
6 #include "chrome/browser/accessibility/invert_bubble_views.h" 6 #include "chrome/browser/accessibility/invert_bubble_views.h"
7 #include "chrome/browser/prefs/pref_service.h" 7 #include "chrome/browser/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"
10 #include "chrome/browser/ui/browser_finder.h"
9 #include "chrome/browser/ui/browser_list.h" 11 #include "chrome/browser/ui/browser_list.h"
10 #include "chrome/browser/ui/views/event_utils.h" 12 #include "chrome/browser/ui/views/event_utils.h"
11 #include "chrome/common/pref_names.h" 13 #include "chrome/common/pref_names.h"
12 #include "content/public/browser/page_navigator.h" 14 #include "content/public/browser/page_navigator.h"
13 #include "grit/generated_resources.h" 15 #include "grit/generated_resources.h"
14 #include "ui/base/l10n/l10n_util.h" 16 #include "ui/base/l10n/l10n_util.h"
15 #include "ui/base/resource/resource_bundle.h" 17 #include "ui/base/resource/resource_bundle.h"
16 #include "ui/gfx/sys_color_change_listener.h" 18 #include "ui/gfx/sys_color_change_listener.h"
17 #include "ui/views/bubble/bubble_delegate.h" 19 #include "ui/views/bubble/bubble_delegate.h"
18 #include "ui/views/controls/label.h" 20 #include "ui/views/controls/label.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 OpenLink(kDarkThemeSearchUrl, event_flags); 136 OpenLink(kDarkThemeSearchUrl, event_flags);
135 else if (source == learn_more_) 137 else if (source == learn_more_)
136 OpenLink(kLearnMoreUrl, event_flags); 138 OpenLink(kLearnMoreUrl, event_flags);
137 else if (source == close_) 139 else if (source == close_)
138 GetWidget()->Close(); 140 GetWidget()->Close();
139 else 141 else
140 NOTREACHED(); 142 NOTREACHED();
141 } 143 }
142 144
143 void InvertBubbleView::OpenLink(const std::string& url, int event_flags) { 145 void InvertBubbleView::OpenLink(const std::string& url, int event_flags) {
144 Browser* browser = BrowserList::GetLastActiveWithProfile(profile_); 146 Browser* browser = browser::FindLastActiveWithProfile(profile_);
145 if (browser) { 147 if (browser) {
146 WindowOpenDisposition disposition = 148 WindowOpenDisposition disposition =
147 event_utils::DispositionFromEventFlags(event_flags); 149 event_utils::DispositionFromEventFlags(event_flags);
148 content::OpenURLParams params( 150 content::OpenURLParams params(
149 GURL(url), content::Referrer(), 151 GURL(url), content::Referrer(),
150 disposition == CURRENT_TAB ? NEW_FOREGROUND_TAB : disposition, 152 disposition == CURRENT_TAB ? NEW_FOREGROUND_TAB : disposition,
151 content::PAGE_TRANSITION_LINK, false); 153 content::PAGE_TRANSITION_LINK, false);
152 browser->OpenURL(params); 154 browser->OpenURL(params);
153 } 155 }
154 } 156 }
155 157
156 // static 158 // static
157 void InvertBubble::RegisterUserPrefs(PrefService* prefs) { 159 void InvertBubble::RegisterUserPrefs(PrefService* prefs) {
158 prefs->RegisterBooleanPref(prefs::kInvertNotificationShown, 160 prefs->RegisterBooleanPref(prefs::kInvertNotificationShown,
159 false, 161 false,
160 PrefService::UNSYNCABLE_PREF); 162 PrefService::UNSYNCABLE_PREF);
161 } 163 }
162 164
163 void InvertBubble::MaybeShowInvertBubble(Profile* profile, 165 void InvertBubble::MaybeShowInvertBubble(Profile* profile,
164 views::View* anchor_view) { 166 views::View* anchor_view) {
165 PrefService* pref_service = profile->GetPrefs(); 167 PrefService* pref_service = profile->GetPrefs();
166 if (gfx::IsInvertedColorScheme() && 168 if (gfx::IsInvertedColorScheme() &&
167 !pref_service->GetBoolean(prefs::kInvertNotificationShown)) { 169 !pref_service->GetBoolean(prefs::kInvertNotificationShown)) {
168 pref_service->SetBoolean(prefs::kInvertNotificationShown, true); 170 pref_service->SetBoolean(prefs::kInvertNotificationShown, true);
169 InvertBubbleView* delegate = new InvertBubbleView(profile, anchor_view); 171 InvertBubbleView* delegate = new InvertBubbleView(profile, anchor_view);
170 views::BubbleDelegateView::CreateBubble(delegate); 172 views::BubbleDelegateView::CreateBubble(delegate);
171 delegate->StartFade(true); 173 delegate->StartFade(true);
172 } 174 }
173 } 175 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/app_controller_mac.mm » ('j') | chrome/browser/ui/browser_finder.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698