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

Side by Side Diff: chrome/browser/automation/testing_automation_provider.cc

Issue 9169096: Remove a bunch of GetProfileSyncService callers to use the new factory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rm todos Created 8 years, 10 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/automation/testing_automation_provider.h" 5 #include "chrome/browser/automation/testing_automation_provider.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 #include "chrome/browser/profiles/profile.h" 75 #include "chrome/browser/profiles/profile.h"
76 #include "chrome/browser/profiles/profile_info_cache.h" 76 #include "chrome/browser/profiles/profile_info_cache.h"
77 #include "chrome/browser/profiles/profile_manager.h" 77 #include "chrome/browser/profiles/profile_manager.h"
78 #include "chrome/browser/protector/protector_service.h" 78 #include "chrome/browser/protector/protector_service.h"
79 #include "chrome/browser/protector/protector_service_factory.h" 79 #include "chrome/browser/protector/protector_service_factory.h"
80 #include "chrome/browser/search_engines/template_url.h" 80 #include "chrome/browser/search_engines/template_url.h"
81 #include "chrome/browser/search_engines/template_url_service.h" 81 #include "chrome/browser/search_engines/template_url_service.h"
82 #include "chrome/browser/search_engines/template_url_service_factory.h" 82 #include "chrome/browser/search_engines/template_url_service_factory.h"
83 #include "chrome/browser/sessions/restore_tab_helper.h" 83 #include "chrome/browser/sessions/restore_tab_helper.h"
84 #include "chrome/browser/sessions/session_service_factory.h" 84 #include "chrome/browser/sessions/session_service_factory.h"
85 #include "chrome/browser/sync/profile_sync_service.h"
86 #include "chrome/browser/sync/profile_sync_service_factory.h"
85 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" 87 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h"
86 #include "chrome/browser/tab_contents/link_infobar_delegate.h" 88 #include "chrome/browser/tab_contents/link_infobar_delegate.h"
87 #include "chrome/browser/themes/theme_service.h" 89 #include "chrome/browser/themes/theme_service.h"
88 #include "chrome/browser/themes/theme_service_factory.h" 90 #include "chrome/browser/themes/theme_service_factory.h"
89 #include "chrome/browser/translate/translate_infobar_delegate.h" 91 #include "chrome/browser/translate/translate_infobar_delegate.h"
90 #include "chrome/browser/translate/translate_tab_helper.h" 92 #include "chrome/browser/translate/translate_tab_helper.h"
91 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" 93 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h"
92 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h" 94 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h"
93 #include "chrome/browser/ui/app_modal_dialogs/js_modal_dialog.h" 95 #include "chrome/browser/ui/app_modal_dialogs/js_modal_dialog.h"
94 #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h" 96 #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h"
(...skipping 5013 matching lines...) Expand 10 before | Expand all | Expand 10 after
5108 sync_waiter_.reset( 5110 sync_waiter_.reset(
5109 ProfileSyncServiceHarness::CreateAndAttach(browser->profile())); 5111 ProfileSyncServiceHarness::CreateAndAttach(browser->profile()));
5110 } 5112 }
5111 if (!sync_waiter_->IsSyncAlreadySetup()) { 5113 if (!sync_waiter_->IsSyncAlreadySetup()) {
5112 reply.SendError("Not signed in to sync"); 5114 reply.SendError("Not signed in to sync");
5113 return; 5115 return;
5114 } 5116 }
5115 // Ensure that the profile sync service and sync backend host are initialized 5117 // Ensure that the profile sync service and sync backend host are initialized
5116 // before waiting for sync cycle completion. In cases where the browser is 5118 // before waiting for sync cycle completion. In cases where the browser is
5117 // restarted with sync enabled, these operations may still be in flight. 5119 // restarted with sync enabled, these operations may still be in flight.
5118 if (!browser->profile()->GetProfileSyncService()) { 5120 if (ProfileSyncServiceFactory::GetInstance()->GetForProfile(
5121 browser->profile()) == NULL) {
5119 reply.SendError("ProfileSyncService initialization failed."); 5122 reply.SendError("ProfileSyncService initialization failed.");
5120 return; 5123 return;
5121 } 5124 }
5122 if (!sync_waiter_->service()->sync_initialized() && 5125 if (!sync_waiter_->service()->sync_initialized() &&
5123 !sync_waiter_->AwaitBackendInitialized()) { 5126 !sync_waiter_->AwaitBackendInitialized()) {
5124 reply.SendError("Sync backend host initialization failed."); 5127 reply.SendError("Sync backend host initialization failed.");
5125 return; 5128 return;
5126 } 5129 }
5127 if (!sync_waiter_->AwaitFullSyncCompletion("Waiting for sync cycle")) { 5130 if (!sync_waiter_->AwaitFullSyncCompletion("Waiting for sync cycle")) {
5128 reply.SendError("Sync cycle did not complete."); 5131 reply.SendError("Sync cycle did not complete.");
(...skipping 20 matching lines...) Expand all
5149 IPC::Message* reply_message) { 5152 IPC::Message* reply_message) {
5150 AutomationJSONReply reply(this, reply_message); 5153 AutomationJSONReply reply(this, reply_message);
5151 if (sync_waiter_.get() == NULL) { 5154 if (sync_waiter_.get() == NULL) {
5152 sync_waiter_.reset( 5155 sync_waiter_.reset(
5153 ProfileSyncServiceHarness::CreateAndAttach(browser->profile())); 5156 ProfileSyncServiceHarness::CreateAndAttach(browser->profile()));
5154 } 5157 }
5155 if (!sync_waiter_->IsSyncAlreadySetup()) { 5158 if (!sync_waiter_->IsSyncAlreadySetup()) {
5156 reply.SendError("Not signed in to sync"); 5159 reply.SendError("Not signed in to sync");
5157 return; 5160 return;
5158 } 5161 }
5159 if (!browser->profile()->GetProfileSyncService()) { 5162 if (ProfileSyncServiceFactory::GetInstance()->GetForProfile(
5163 browser->profile()) == NULL) {
5160 reply.SendError("ProfileSyncService initialization failed."); 5164 reply.SendError("ProfileSyncService initialization failed.");
5161 return; 5165 return;
5162 } 5166 }
5163 if (!sync_waiter_->AwaitSyncRestart()) { 5167 if (!sync_waiter_->AwaitSyncRestart()) {
5164 reply.SendError("Sync did not successfully restart."); 5168 reply.SendError("Sync did not successfully restart.");
5165 return; 5169 return;
5166 } 5170 }
5167 ProfileSyncService::Status status = sync_waiter_->GetStatus(); 5171 ProfileSyncService::Status status = sync_waiter_->GetStatus();
5168 if (status.summary == ProfileSyncService::Status::READY) { 5172 if (status.summary == ProfileSyncService::Status::READY) {
5169 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); 5173 scoped_ptr<DictionaryValue> return_value(new DictionaryValue);
(...skipping 1688 matching lines...) Expand 10 before | Expand all | Expand 10 after
6858 6862
6859 Send(reply_message_); 6863 Send(reply_message_);
6860 redirect_query_ = 0; 6864 redirect_query_ = 0;
6861 reply_message_ = NULL; 6865 reply_message_ = NULL;
6862 } 6866 }
6863 6867
6864 void TestingAutomationProvider::OnRemoveProvider() { 6868 void TestingAutomationProvider::OnRemoveProvider() {
6865 if (g_browser_process) 6869 if (g_browser_process)
6866 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); 6870 g_browser_process->GetAutomationProviderList()->RemoveProvider(this);
6867 } 6871 }
OLDNEW
« no previous file with comments | « chrome/browser/autofill/personal_data_manager.cc ('k') | chrome/browser/chromeos/login/login_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698