OLD | NEW |
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/history/history_types.h" | 17 #include "chrome/browser/history/history_types.h" |
18 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
19 #include "components/bookmarks/browser/bookmark_model.h" | 19 #include "components/bookmarks/browser/bookmark_model.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" | 25 #include "chrome/browser/extensions/extension_service.h" |
26 #include "chrome/common/extensions/extension_constants.h" | 26 #include "chrome/common/extensions/extension_constants.h" |
27 #include "chrome/common/extensions/sync_helper.h" | 27 #include "chrome/common/extensions/sync_helper.h" |
28 #include "extensions/browser/extension_system.h" | 28 #include "extensions/browser/extension_system.h" |
| 29 #include "extensions/common/constants.h" |
29 #include "extensions/common/extension.h" | 30 #include "extensions/common/extension.h" |
30 #include "extensions/common/extension_set.h" | 31 #include "extensions/common/extension_set.h" |
31 #endif | 32 #endif |
32 | 33 |
33 namespace { | 34 namespace { |
34 | 35 |
35 const int kHistoryEntriesBeforeNewProfilePrompt = 10; | 36 const int kHistoryEntriesBeforeNewProfilePrompt = 10; |
36 | 37 |
37 // Determines whether a profile has any typed URLs in its history. | 38 // Determines whether a profile has any typed URLs in its history. |
38 class HasTypedURLsTask : public history::HistoryDBTask { | 39 class HasTypedURLsTask : public history::HistoryDBTask { |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 extensions::ExtensionSystem::Get(profile); | 201 extensions::ExtensionSystem::Get(profile); |
201 if (system && system->extension_service()) { | 202 if (system && system->extension_service()) { |
202 const extensions::ExtensionSet* extensions = | 203 const extensions::ExtensionSet* extensions = |
203 system->extension_service()->extensions(); | 204 system->extension_service()->extensions(); |
204 for (extensions::ExtensionSet::const_iterator iter = extensions->begin(); | 205 for (extensions::ExtensionSet::const_iterator iter = extensions->begin(); |
205 iter != extensions->end(); ++iter) { | 206 iter != extensions->end(); ++iter) { |
206 // The webstore is synced so that it stays put on the new tab | 207 // The webstore is synced so that it stays put on the new tab |
207 // page, but since it's installed by default we don't want to | 208 // page, but since it's installed by default we don't want to |
208 // consider it when determining if the profile is dirty. | 209 // consider it when determining if the profile is dirty. |
209 if (extensions::sync_helper::IsSyncable(iter->get()) && | 210 if (extensions::sync_helper::IsSyncable(iter->get()) && |
210 (*iter)->id() != extension_misc::kWebStoreAppId && | 211 (*iter)->id() != extensions::kWebStoreAppId && |
211 (*iter)->id() != extension_misc::kChromeAppId) { | 212 (*iter)->id() != extension_misc::kChromeAppId) { |
212 DVLOG(1) << "ProfileSigninConfirmationHelper: " | 213 DVLOG(1) << "ProfileSigninConfirmationHelper: " |
213 << "profile contains a synced extension: " << (*iter)->id(); | 214 << "profile contains a synced extension: " << (*iter)->id(); |
214 return true; | 215 return true; |
215 } | 216 } |
216 } | 217 } |
217 } | 218 } |
218 #endif | 219 #endif |
219 return false; | 220 return false; |
220 } | 221 } |
(...skipping 10 matching lines...) Expand all Loading... |
231 return; | 232 return; |
232 } | 233 } |
233 // Fire asynchronous queries for profile data. | 234 // Fire asynchronous queries for profile data. |
234 ProfileSigninConfirmationHelper* helper = | 235 ProfileSigninConfirmationHelper* helper = |
235 new ProfileSigninConfirmationHelper(profile, return_result); | 236 new ProfileSigninConfirmationHelper(profile, return_result); |
236 helper->CheckHasHistory(kHistoryEntriesBeforeNewProfilePrompt); | 237 helper->CheckHasHistory(kHistoryEntriesBeforeNewProfilePrompt); |
237 helper->CheckHasTypedURLs(); | 238 helper->CheckHasTypedURLs(); |
238 } | 239 } |
239 | 240 |
240 } // namespace ui | 241 } // namespace ui |
OLD | NEW |