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

Side by Side Diff: chrome/browser/extensions/app_notify_channel_ui.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
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 "chrome/browser/extensions/app_notify_channel_ui.h" 5 #include "chrome/browser/extensions/app_notify_channel_ui.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/infobars/infobar_tab_helper.h" 8 #include "chrome/browser/infobars/infobar_tab_helper.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/signin/signin_manager.h" 10 #include "chrome/browser/signin/signin_manager.h"
11 #include "chrome/browser/signin/signin_manager_factory.h" 11 #include "chrome/browser/signin/signin_manager_factory.h"
12 #include "chrome/browser/sync/profile_sync_service.h" 12 #include "chrome/browser/sync/profile_sync_service.h"
13 #include "chrome/browser/sync/profile_sync_service_factory.h" 13 #include "chrome/browser/sync/profile_sync_service_factory.h"
14 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" 14 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h"
15 #include "chrome/browser/ui/browser.h" 15 #include "chrome/browser/ui/browser.h"
16 #include "chrome/browser/ui/browser_list.h" 16 #include "chrome/browser/ui/browser_finder.h"
17 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 17 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
18 #include "chrome/browser/ui/webui/signin/login_ui_service.h" 18 #include "chrome/browser/ui/webui/signin/login_ui_service.h"
19 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" 19 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
20 #include "chrome/common/url_constants.h" 20 #include "chrome/common/url_constants.h"
21 #include "content/public/browser/notification_details.h" 21 #include "content/public/browser/notification_details.h"
22 #include "content/public/browser/notification_observer.h" 22 #include "content/public/browser/notification_observer.h"
23 #include "content/public/browser/notification_registrar.h" 23 #include "content/public/browser/notification_registrar.h"
24 #include "content/public/browser/notification_source.h" 24 #include "content/public/browser/notification_source.h"
25 #include "content/public/browser/notification_service.h" 25 #include "content/public/browser/notification_service.h"
26 #include "content/public/browser/notification_types.h" 26 #include "content/public/browser/notification_types.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 login_ui->FocusUI(); 146 login_ui->FocusUI();
147 return; 147 return;
148 } else { 148 } else {
149 // User is already logged in, so close whatever sync config UI the 149 // User is already logged in, so close whatever sync config UI the
150 // user is looking at and display new login UI. 150 // user is looking at and display new login UI.
151 login_ui->CloseUI(); 151 login_ui->CloseUI();
152 DCHECK(!login_ui_service->current_login_ui()); 152 DCHECK(!login_ui_service->current_login_ui());
153 } 153 }
154 } 154 }
155 // Any existing UI is now closed - display new login UI. 155 // Any existing UI is now closed - display new login UI.
156 Browser* browser = BrowserList::GetLastActiveWithProfile(profile_); 156 Browser* browser = browser::FindLastActiveWithProfile(profile_);
157 if (browser) { 157 if (browser) {
158 browser->ShowOptionsTab(chrome::kSyncSetupForceLoginSubPage); 158 browser->ShowOptionsTab(chrome::kSyncSetupForceLoginSubPage);
159 return; 159 return;
160 } 160 }
161 // Should not be possible to have no browser here, since we're in an 161 // Should not be possible to have no browser here, since we're in an
162 // infobar callback. 162 // infobar callback.
163 NOTREACHED(); 163 NOTREACHED();
164 } 164 }
165 delegate_->OnSyncSetupResult(false); 165 delegate_->OnSyncSetupResult(false);
166 } 166 }
(...skipping 27 matching lines...) Expand all
194 ProfileSyncServiceFactory::GetInstance()->GetForProfile( 194 ProfileSyncServiceFactory::GetInstance()->GetForProfile(
195 profile_)->AddObserver(this); 195 profile_)->AddObserver(this);
196 } 196 }
197 197
198 void AppNotifyChannelUIImpl::StopObservingSync() { 198 void AppNotifyChannelUIImpl::StopObservingSync() {
199 CHECK(observing_sync_); 199 CHECK(observing_sync_);
200 observing_sync_ = false; 200 observing_sync_ = false;
201 ProfileSyncServiceFactory::GetInstance()->GetForProfile( 201 ProfileSyncServiceFactory::GetInstance()->GetForProfile(
202 profile_)->RemoveObserver(this); 202 profile_)->RemoveObserver(this);
203 } 203 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698