| 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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 display_pref->GetString(path, &per_display_value)) { | 178 display_pref->GetString(path, &per_display_value)) { |
| 179 return per_display_value; | 179 return per_display_value; |
| 180 } | 180 } |
| 181 } | 181 } |
| 182 | 182 |
| 183 return value; | 183 return value; |
| 184 } | 184 } |
| 185 | 185 |
| 186 // If prefs have synced and no user-set value exists at |local_path|, the value | 186 // If prefs have synced and no user-set value exists at |local_path|, the value |
| 187 // from |synced_path| is copied to |local_path|. | 187 // from |synced_path| is copied to |local_path|. |
| 188 void MaybePropagatePrefToLocal(PrefService* pref_service, | 188 void MaybePropagatePrefToLocal(PrefServiceSyncable* pref_service, |
| 189 const char* local_path, | 189 const char* local_path, |
| 190 const char* synced_path) { | 190 const char* synced_path) { |
| 191 if (!pref_service->FindPreference(local_path)->HasUserSetting() && | 191 if (!pref_service->FindPreference(local_path)->HasUserSetting() && |
| 192 pref_service->IsSyncing()) { | 192 pref_service->IsSyncing()) { |
| 193 // First time the user is using this machine, propagate from remote to | 193 // First time the user is using this machine, propagate from remote to |
| 194 // local. | 194 // local. |
| 195 pref_service->SetString(local_path, pref_service->GetString(synced_path)); | 195 pref_service->SetString(local_path, pref_service->GetString(synced_path)); |
| 196 } | 196 } |
| 197 } | 197 } |
| 198 | 198 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 profile_->GetPrefs()->RemoveObserver(this); | 264 profile_->GetPrefs()->RemoveObserver(this); |
| 265 } | 265 } |
| 266 | 266 |
| 267 void ChromeLauncherControllerPerApp::Init() { | 267 void ChromeLauncherControllerPerApp::Init() { |
| 268 UpdateAppLaunchersFromPref(); | 268 UpdateAppLaunchersFromPref(); |
| 269 | 269 |
| 270 // TODO(sky): update unit test so that this test isn't necessary. | 270 // TODO(sky): update unit test so that this test isn't necessary. |
| 271 if (ash::Shell::HasInstance()) { | 271 if (ash::Shell::HasInstance()) { |
| 272 SetShelfAutoHideBehaviorFromPrefs(); | 272 SetShelfAutoHideBehaviorFromPrefs(); |
| 273 SetShelfAlignmentFromPrefs(); | 273 SetShelfAlignmentFromPrefs(); |
| 274 PrefService* prefs = profile_->GetPrefs(); | 274 PrefServiceSyncable* prefs = profile_->GetPrefs(); |
| 275 if (!prefs->FindPreference(prefs::kShelfAlignmentLocal)->HasUserSetting() || | 275 if (!prefs->FindPreference(prefs::kShelfAlignmentLocal)->HasUserSetting() || |
| 276 !prefs->FindPreference(prefs::kShelfAutoHideBehaviorLocal)-> | 276 !prefs->FindPreference(prefs::kShelfAutoHideBehaviorLocal)-> |
| 277 HasUserSetting()) { | 277 HasUserSetting()) { |
| 278 // This causes OnIsSyncingChanged to be called when the value of | 278 // This causes OnIsSyncingChanged to be called when the value of |
| 279 // PrefService::IsSyncing() changes. | 279 // PrefService::IsSyncing() changes. |
| 280 prefs->AddObserver(this); | 280 prefs->AddObserver(this); |
| 281 } | 281 } |
| 282 ash::Shell::GetInstance()->AddShellObserver(this); | 282 ash::Shell::GetInstance()->AddShellObserver(this); |
| 283 } | 283 } |
| 284 } | 284 } |
| (...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1178 void ChromeLauncherControllerPerApp::SetAppIconLoaderForTest( | 1178 void ChromeLauncherControllerPerApp::SetAppIconLoaderForTest( |
| 1179 AppIconLoader* loader) { | 1179 AppIconLoader* loader) { |
| 1180 app_icon_loader_.reset(loader); | 1180 app_icon_loader_.reset(loader); |
| 1181 } | 1181 } |
| 1182 | 1182 |
| 1183 const std::string& | 1183 const std::string& |
| 1184 ChromeLauncherControllerPerApp::GetAppIdFromLauncherIdForTest( | 1184 ChromeLauncherControllerPerApp::GetAppIdFromLauncherIdForTest( |
| 1185 ash::LauncherID id) { | 1185 ash::LauncherID id) { |
| 1186 return id_to_item_controller_map_[id]->app_id(); | 1186 return id_to_item_controller_map_[id]->app_id(); |
| 1187 } | 1187 } |
| OLD | NEW |