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 "chrome/browser/bookmarks/bookmark_model.h" | 11 #include "chrome/browser/bookmarks/bookmark_model.h" |
12 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 12 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
13 #include "chrome/browser/common/cancelable_request.h" | 13 #include "chrome/browser/common/cancelable_request.h" |
14 #include "chrome/browser/extensions/extension_service.h" | 14 #include "chrome/browser/extensions/extension_service.h" |
15 #include "chrome/browser/extensions/extension_system.h" | 15 #include "chrome/browser/extensions/extension_system.h" |
16 #include "chrome/browser/history/history_backend.h" | 16 #include "chrome/browser/history/history_backend.h" |
17 #include "chrome/browser/history/history_db_task.h" | 17 #include "chrome/browser/history/history_db_task.h" |
18 #include "chrome/browser/history/history_service.h" | 18 #include "chrome/browser/history/history_service.h" |
19 #include "chrome/browser/history/history_service_factory.h" | 19 #include "chrome/browser/history/history_service_factory.h" |
20 #include "chrome/browser/history/history_types.h" | 20 #include "chrome/browser/history/history_types.h" |
21 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
22 #include "chrome/common/extensions/extension_set.h" | |
23 #include "chrome/common/extensions/sync_helper.h" | 22 #include "chrome/common/extensions/sync_helper.h" |
24 #include "extensions/common/extension.h" | 23 #include "extensions/common/extension.h" |
| 24 #include "extensions/common/extension_set.h" |
25 #include "ui/gfx/color_utils.h" | 25 #include "ui/gfx/color_utils.h" |
26 #include "ui/native_theme/native_theme.h" | 26 #include "ui/native_theme/native_theme.h" |
27 | 27 |
28 // TODO(dconnelly): change VLOG to DVLOG (crbug.com/240195) | 28 // TODO(dconnelly): change VLOG to DVLOG (crbug.com/240195) |
29 | 29 |
30 namespace { | 30 namespace { |
31 | 31 |
32 const int kHistoryEntriesBeforeNewProfilePrompt = 10; | 32 const int kHistoryEntriesBeforeNewProfilePrompt = 10; |
33 | 33 |
34 // Determines whether a profile has any typed URLs in its history. | 34 // Determines whether a profile has any typed URLs in its history. |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 bool has_been_shutdown = !profile->IsNewProfile(); | 193 bool has_been_shutdown = !profile->IsNewProfile(); |
194 if (has_been_shutdown) | 194 if (has_been_shutdown) |
195 VLOG(1) << "ProfileSigninConfirmationHelper: profile is not new"; | 195 VLOG(1) << "ProfileSigninConfirmationHelper: profile is not new"; |
196 return has_been_shutdown; | 196 return has_been_shutdown; |
197 } | 197 } |
198 | 198 |
199 bool HasSyncedExtensions(Profile* profile) { | 199 bool HasSyncedExtensions(Profile* profile) { |
200 extensions::ExtensionSystem* system = | 200 extensions::ExtensionSystem* system = |
201 extensions::ExtensionSystem::Get(profile); | 201 extensions::ExtensionSystem::Get(profile); |
202 if (system && system->extension_service()) { | 202 if (system && system->extension_service()) { |
203 const ExtensionSet* extensions = system->extension_service()->extensions(); | 203 const extensions::ExtensionSet* extensions = |
204 for (ExtensionSet::const_iterator iter = extensions->begin(); | 204 system->extension_service()->extensions(); |
| 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() != extension_misc::kWebStoreAppId && |
211 (*iter)->id() != extension_misc::kChromeAppId) { | 212 (*iter)->id() != extension_misc::kChromeAppId) { |
212 VLOG(1) << "ProfileSigninConfirmationHelper: " | 213 VLOG(1) << "ProfileSigninConfirmationHelper: " |
213 << "profile contains a synced extension: " << (*iter)->id(); | 214 << "profile contains a synced extension: " << (*iter)->id(); |
214 return true; | 215 return true; |
(...skipping 15 matching lines...) Expand all Loading... |
230 // Fire asynchronous queries for profile data. | 231 // Fire asynchronous queries for profile data. |
231 scoped_refptr<ProfileSigninConfirmationHelper> helper = | 232 scoped_refptr<ProfileSigninConfirmationHelper> helper = |
232 new ProfileSigninConfirmationHelper(profile, return_result); | 233 new ProfileSigninConfirmationHelper(profile, return_result); |
233 const int requests = 2; | 234 const int requests = 2; |
234 helper->set_pending_requests(requests); | 235 helper->set_pending_requests(requests); |
235 helper->CheckHasHistory(kHistoryEntriesBeforeNewProfilePrompt); | 236 helper->CheckHasHistory(kHistoryEntriesBeforeNewProfilePrompt); |
236 helper->CheckHasTypedURLs(); | 237 helper->CheckHasTypedURLs(); |
237 } | 238 } |
238 | 239 |
239 } // namespace ui | 240 } // namespace ui |
OLD | NEW |