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/apps/shortcut_manager.h" | 5 #include "chrome/browser/apps/shortcut_manager.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 void SetCurrentAppShortcutsVersion(PrefService* prefs) { | 68 void SetCurrentAppShortcutsVersion(PrefService* prefs) { |
69 prefs->SetInteger(prefs::kAppShortcutsVersion, kCurrentAppShortcutsVersion); | 69 prefs->SetInteger(prefs::kAppShortcutsVersion, kCurrentAppShortcutsVersion); |
70 } | 70 } |
71 | 71 |
72 } // namespace | 72 } // namespace |
73 | 73 |
74 // static | 74 // static |
75 void AppShortcutManager::RegisterProfilePrefs( | 75 void AppShortcutManager::RegisterProfilePrefs( |
76 user_prefs::PrefRegistrySyncable* registry) { | 76 user_prefs::PrefRegistrySyncable* registry) { |
77 // Indicates whether app shortcuts have been created. | 77 // Indicates whether app shortcuts have been created. |
78 registry->RegisterIntegerPref( | 78 registry->RegisterIntegerPref(prefs::kAppShortcutsVersion, 0); |
79 prefs::kAppShortcutsVersion, 0, | |
80 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
81 } | 79 } |
82 | 80 |
83 AppShortcutManager::AppShortcutManager(Profile* profile) | 81 AppShortcutManager::AppShortcutManager(Profile* profile) |
84 : profile_(profile), | 82 : profile_(profile), |
85 is_profile_info_cache_observer_(false), | 83 is_profile_info_cache_observer_(false), |
86 prefs_(profile->GetPrefs()), | 84 prefs_(profile->GetPrefs()), |
87 extension_registry_observer_(this), | 85 extension_registry_observer_(this), |
88 weak_ptr_factory_(this) { | 86 weak_ptr_factory_(this) { |
89 // Use of g_browser_process requires that we are either on the UI thread, or | 87 // Use of g_browser_process requires that we are either on the UI thread, or |
90 // there are no threads initialized (such as in unit tests). | 88 // there are no threads initialized (such as in unit tests). |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 return; | 162 return; |
165 | 163 |
166 content::BrowserThread::PostDelayedTask( | 164 content::BrowserThread::PostDelayedTask( |
167 content::BrowserThread::UI, | 165 content::BrowserThread::UI, |
168 FROM_HERE, | 166 FROM_HERE, |
169 base::Bind(&web_app::UpdateShortcutsForAllApps, | 167 base::Bind(&web_app::UpdateShortcutsForAllApps, |
170 profile_, | 168 profile_, |
171 base::Bind(&SetCurrentAppShortcutsVersion, prefs_)), | 169 base::Bind(&SetCurrentAppShortcutsVersion, prefs_)), |
172 base::TimeDelta::FromSeconds(kUpdateShortcutsForAllAppsDelay)); | 170 base::TimeDelta::FromSeconds(kUpdateShortcutsForAllAppsDelay)); |
173 } | 171 } |
OLD | NEW |