| OLD | NEW |
| 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/ui/ash/launcher/chrome_launcher_controller_per_app.h" | 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "ash/launcher/launcher_model.h" | 9 #include "ash/launcher/launcher_model.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 display_pref->GetString(path, &per_display_value)) { | 124 display_pref->GetString(path, &per_display_value)) { |
| 125 return per_display_value; | 125 return per_display_value; |
| 126 } | 126 } |
| 127 } | 127 } |
| 128 | 128 |
| 129 return value; | 129 return value; |
| 130 } | 130 } |
| 131 | 131 |
| 132 // If prefs have synced and no user-set value exists at |local_path|, the value | 132 // If prefs have synced and no user-set value exists at |local_path|, the value |
| 133 // from |synced_path| is copied to |local_path|. | 133 // from |synced_path| is copied to |local_path|. |
| 134 void MaybePropagatePrefToLocal(PrefService* pref_service, | 134 void MaybePropagatePrefToLocal(PrefServiceSyncable* pref_service, |
| 135 const char* local_path, | 135 const char* local_path, |
| 136 const char* synced_path) { | 136 const char* synced_path) { |
| 137 if (!pref_service->FindPreference(local_path)->HasUserSetting() && | 137 if (!pref_service->FindPreference(local_path)->HasUserSetting() && |
| 138 pref_service->IsSyncing()) { | 138 pref_service->IsSyncing()) { |
| 139 // First time the user is using this machine, propagate from remote to | 139 // First time the user is using this machine, propagate from remote to |
| 140 // local. | 140 // local. |
| 141 pref_service->SetString(local_path, pref_service->GetString(synced_path)); | 141 pref_service->SetString(local_path, pref_service->GetString(synced_path)); |
| 142 } | 142 } |
| 143 } | 143 } |
| 144 | 144 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 profile_->GetPrefs()->RemoveObserver(this); | 215 profile_->GetPrefs()->RemoveObserver(this); |
| 216 } | 216 } |
| 217 | 217 |
| 218 void ChromeLauncherControllerPerApp::Init() { | 218 void ChromeLauncherControllerPerApp::Init() { |
| 219 UpdateAppLaunchersFromPref(); | 219 UpdateAppLaunchersFromPref(); |
| 220 | 220 |
| 221 // TODO(sky): update unit test so that this test isn't necessary. | 221 // TODO(sky): update unit test so that this test isn't necessary. |
| 222 if (ash::Shell::HasInstance()) { | 222 if (ash::Shell::HasInstance()) { |
| 223 SetShelfAutoHideBehaviorFromPrefs(); | 223 SetShelfAutoHideBehaviorFromPrefs(); |
| 224 SetShelfAlignmentFromPrefs(); | 224 SetShelfAlignmentFromPrefs(); |
| 225 PrefService* prefs = profile_->GetPrefs(); | 225 PrefServiceSyncable* prefs = profile_->GetPrefs(); |
| 226 if (!prefs->FindPreference(prefs::kShelfAlignmentLocal)->HasUserSetting() || | 226 if (!prefs->FindPreference(prefs::kShelfAlignmentLocal)->HasUserSetting() || |
| 227 !prefs->FindPreference(prefs::kShelfAutoHideBehaviorLocal)-> | 227 !prefs->FindPreference(prefs::kShelfAutoHideBehaviorLocal)-> |
| 228 HasUserSetting()) { | 228 HasUserSetting()) { |
| 229 // This causes OnIsSyncingChanged to be called when the value of | 229 // This causes OnIsSyncingChanged to be called when the value of |
| 230 // PrefService::IsSyncing() changes. | 230 // PrefService::IsSyncing() changes. |
| 231 prefs->AddObserver(this); | 231 prefs->AddObserver(this); |
| 232 } | 232 } |
| 233 ash::Shell::GetInstance()->AddShellObserver(this); | 233 ash::Shell::GetInstance()->AddShellObserver(this); |
| 234 } | 234 } |
| 235 } | 235 } |
| (...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1234 FaviconTabHelper* favicon_tab_helper = | 1234 FaviconTabHelper* favicon_tab_helper = |
| 1235 FaviconTabHelper::FromWebContents(web_contents); | 1235 FaviconTabHelper::FromWebContents(web_contents); |
| 1236 gfx::Image app_icon = favicon_tab_helper->GetFavicon(); | 1236 gfx::Image app_icon = favicon_tab_helper->GetFavicon(); |
| 1237 items->push_back(new ChromeLauncherAppMenuItemBrowser( | 1237 items->push_back(new ChromeLauncherAppMenuItemBrowser( |
| 1238 web_contents->GetTitle(), | 1238 web_contents->GetTitle(), |
| 1239 app_icon.IsEmpty() ? NULL : &app_icon, | 1239 app_icon.IsEmpty() ? NULL : &app_icon, |
| 1240 browser)); | 1240 browser)); |
| 1241 } | 1241 } |
| 1242 return items; | 1242 return items; |
| 1243 } | 1243 } |
| OLD | NEW |