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

Side by Side Diff: chrome/browser/ui/sync/profile_signin_confirmation_helper.cc

Issue 709813004: Remove the deprecated function ExtensionService::extensions(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed thestig@'s comments. Created 6 years, 1 month 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/sync/profile_signin_confirmation_helper.h" 5 #include "chrome/browser/ui/sync/profile_signin_confirmation_helper.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
11 #include "base/task/cancelable_task_tracker.h" 11 #include "base/task/cancelable_task_tracker.h"
12 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 12 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
13 #include "chrome/browser/history/history_backend.h" 13 #include "chrome/browser/history/history_backend.h"
14 #include "chrome/browser/history/history_db_task.h" 14 #include "chrome/browser/history/history_db_task.h"
15 #include "chrome/browser/history/history_service.h" 15 #include "chrome/browser/history/history_service.h"
16 #include "chrome/browser/history/history_service_factory.h" 16 #include "chrome/browser/history/history_service_factory.h"
17 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
18 #include "components/bookmarks/browser/bookmark_model.h" 18 #include "components/bookmarks/browser/bookmark_model.h"
19 #include "components/history/core/browser/history_types.h" 19 #include "components/history/core/browser/history_types.h"
20 #include "content/public/browser/browser_thread.h" 20 #include "content/public/browser/browser_thread.h"
21 #include "ui/gfx/color_utils.h" 21 #include "ui/gfx/color_utils.h"
22 #include "ui/native_theme/native_theme.h" 22 #include "ui/native_theme/native_theme.h"
23 23
24 #if defined(ENABLE_EXTENSIONS) 24 #if defined(ENABLE_EXTENSIONS)
25 #include "chrome/browser/extensions/extension_service.h"
26 #include "chrome/common/extensions/extension_constants.h" 25 #include "chrome/common/extensions/extension_constants.h"
27 #include "chrome/common/extensions/sync_helper.h" 26 #include "chrome/common/extensions/sync_helper.h"
28 #include "extensions/browser/extension_system.h" 27 #include "extensions/browser/extension_registry.h"
29 #include "extensions/common/constants.h" 28 #include "extensions/common/constants.h"
30 #include "extensions/common/extension.h" 29 #include "extensions/common/extension.h"
31 #include "extensions/common/extension_set.h" 30 #include "extensions/common/extension_set.h"
32 #endif 31 #endif
33 32
34 namespace { 33 namespace {
35 34
36 const int kHistoryEntriesBeforeNewProfilePrompt = 10; 35 const int kHistoryEntriesBeforeNewProfilePrompt = 10;
37 36
38 // Determines whether a profile has any typed URLs in its history. 37 // Determines whether a profile has any typed URLs in its history.
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 #else 196 #else
198 bool has_been_shutdown = !profile->IsNewProfile(); 197 bool has_been_shutdown = !profile->IsNewProfile();
199 if (has_been_shutdown) 198 if (has_been_shutdown)
200 DVLOG(1) << "ProfileSigninConfirmationHelper: profile is not new"; 199 DVLOG(1) << "ProfileSigninConfirmationHelper: profile is not new";
201 return has_been_shutdown; 200 return has_been_shutdown;
202 #endif 201 #endif
203 } 202 }
204 203
205 bool HasSyncedExtensions(Profile* profile) { 204 bool HasSyncedExtensions(Profile* profile) {
206 #if defined(ENABLE_EXTENSIONS) 205 #if defined(ENABLE_EXTENSIONS)
207 extensions::ExtensionSystem* system = 206 extensions::ExtensionRegistry* registry =
208 extensions::ExtensionSystem::Get(profile); 207 extensions::ExtensionRegistry::Get(profile);
209 if (system && system->extension_service()) { 208 if (registry) {
210 const extensions::ExtensionSet* extensions = 209 for (const scoped_refptr<const extensions::Extension>& extension :
211 system->extension_service()->extensions(); 210 registry->enabled_extensions()) {
212 for (extensions::ExtensionSet::const_iterator iter = extensions->begin();
213 iter != extensions->end(); ++iter) {
214 // The webstore is synced so that it stays put on the new tab 211 // The webstore is synced so that it stays put on the new tab
215 // page, but since it's installed by default we don't want to 212 // page, but since it's installed by default we don't want to
216 // consider it when determining if the profile is dirty. 213 // consider it when determining if the profile is dirty.
217 if (extensions::sync_helper::IsSyncable(iter->get()) && 214 if (extensions::sync_helper::IsSyncable(extension.get()) &&
218 (*iter)->id() != extensions::kWebStoreAppId && 215 extension->id() != extensions::kWebStoreAppId &&
219 (*iter)->id() != extension_misc::kChromeAppId) { 216 extension->id() != extension_misc::kChromeAppId) {
220 DVLOG(1) << "ProfileSigninConfirmationHelper: " 217 DVLOG(1) << "ProfileSigninConfirmationHelper: "
221 << "profile contains a synced extension: " << (*iter)->id(); 218 << "profile contains a synced extension: " << extension->id();
222 return true; 219 return true;
223 } 220 }
224 } 221 }
225 } 222 }
226 #endif 223 #endif
227 return false; 224 return false;
228 } 225 }
229 226
230 void CheckShouldPromptForNewProfile( 227 void CheckShouldPromptForNewProfile(
231 Profile* profile, 228 Profile* profile,
232 const base::Callback<void(bool)>& return_result) { 229 const base::Callback<void(bool)>& return_result) {
233 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 230 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
234 231
235 if (HasBeenShutdown(profile) || 232 if (HasBeenShutdown(profile) ||
236 HasBookmarks(profile) || 233 HasBookmarks(profile) ||
237 HasSyncedExtensions(profile)) { 234 HasSyncedExtensions(profile)) {
238 return_result.Run(true); 235 return_result.Run(true);
239 return; 236 return;
240 } 237 }
241 // Fire asynchronous queries for profile data. 238 // Fire asynchronous queries for profile data.
242 ProfileSigninConfirmationHelper* helper = 239 ProfileSigninConfirmationHelper* helper =
243 new ProfileSigninConfirmationHelper(profile, return_result); 240 new ProfileSigninConfirmationHelper(profile, return_result);
244 helper->CheckHasHistory(kHistoryEntriesBeforeNewProfilePrompt); 241 helper->CheckHasHistory(kHistoryEntriesBeforeNewProfilePrompt);
245 helper->CheckHasTypedURLs(); 242 helper->CheckHasTypedURLs();
246 } 243 }
247 244
248 } // namespace ui 245 } // namespace ui
OLDNEW
« no previous file with comments | « chrome/browser/ui/media_utils.cc ('k') | chrome/browser/ui/views/location_bar/origin_chip_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698