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/ash/launcher/chrome_launcher_controller.h" | 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 // See comment in |kShelfAlignment| as to why we consider two prefs. | 245 // See comment in |kShelfAlignment| as to why we consider two prefs. |
246 const std::string alignment_value( | 246 const std::string alignment_value( |
247 GetPrefForRootWindow(profile->GetPrefs(), | 247 GetPrefForRootWindow(profile->GetPrefs(), |
248 root_window, | 248 root_window, |
249 prefs::kShelfAlignmentLocal, | 249 prefs::kShelfAlignmentLocal, |
250 prefs::kShelfAlignment)); | 250 prefs::kShelfAlignment)); |
251 if (alignment_value == ash::kShelfAlignmentLeft) | 251 if (alignment_value == ash::kShelfAlignmentLeft) |
252 return ash::SHELF_ALIGNMENT_LEFT; | 252 return ash::SHELF_ALIGNMENT_LEFT; |
253 else if (alignment_value == ash::kShelfAlignmentRight) | 253 else if (alignment_value == ash::kShelfAlignmentRight) |
254 return ash::SHELF_ALIGNMENT_RIGHT; | 254 return ash::SHELF_ALIGNMENT_RIGHT; |
255 else if (alignment_value == ash::kShelfAlignmentTop) | 255 // Default to bottom. |
256 return ash::SHELF_ALIGNMENT_TOP; | |
257 return ash::SHELF_ALIGNMENT_BOTTOM; | 256 return ash::SHELF_ALIGNMENT_BOTTOM; |
258 } | 257 } |
259 | 258 |
260 // If prefs have synced and no user-set value exists at |local_path|, the value | 259 // If prefs have synced and no user-set value exists at |local_path|, the value |
261 // from |synced_path| is copied to |local_path|. | 260 // from |synced_path| is copied to |local_path|. |
262 void MaybePropagatePrefToLocal( | 261 void MaybePropagatePrefToLocal( |
263 syncable_prefs::PrefServiceSyncable* pref_service, | 262 syncable_prefs::PrefServiceSyncable* pref_service, |
264 const char* local_path, | 263 const char* local_path, |
265 const char* synced_path) { | 264 const char* synced_path) { |
266 if (!pref_service->FindPreference(local_path)->HasUserSetting() && | 265 if (!pref_service->FindPreference(local_path)->HasUserSetting() && |
(...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1289 switch (ash::Shell::GetInstance()->GetShelfAlignment(root_window)) { | 1288 switch (ash::Shell::GetInstance()->GetShelfAlignment(root_window)) { |
1290 case ash::SHELF_ALIGNMENT_BOTTOM: | 1289 case ash::SHELF_ALIGNMENT_BOTTOM: |
1291 pref_value = ash::kShelfAlignmentBottom; | 1290 pref_value = ash::kShelfAlignmentBottom; |
1292 break; | 1291 break; |
1293 case ash::SHELF_ALIGNMENT_LEFT: | 1292 case ash::SHELF_ALIGNMENT_LEFT: |
1294 pref_value = ash::kShelfAlignmentLeft; | 1293 pref_value = ash::kShelfAlignmentLeft; |
1295 break; | 1294 break; |
1296 case ash::SHELF_ALIGNMENT_RIGHT: | 1295 case ash::SHELF_ALIGNMENT_RIGHT: |
1297 pref_value = ash::kShelfAlignmentRight; | 1296 pref_value = ash::kShelfAlignmentRight; |
1298 break; | 1297 break; |
1299 case ash::SHELF_ALIGNMENT_TOP: | |
1300 pref_value = ash::kShelfAlignmentTop; | |
1301 } | 1298 } |
1302 | 1299 |
1303 UpdatePerDisplayPref( | 1300 UpdatePerDisplayPref( |
1304 profile_->GetPrefs(), root_window, prefs::kShelfAlignment, pref_value); | 1301 profile_->GetPrefs(), root_window, prefs::kShelfAlignment, pref_value); |
1305 | 1302 |
1306 if (root_window == ash::Shell::GetPrimaryRootWindow()) { | 1303 if (root_window == ash::Shell::GetPrimaryRootWindow()) { |
1307 // See comment in |kShelfAlignment| about why we have two prefs here. | 1304 // See comment in |kShelfAlignment| about why we have two prefs here. |
1308 profile_->GetPrefs()->SetString(prefs::kShelfAlignmentLocal, pref_value); | 1305 profile_->GetPrefs()->SetString(prefs::kShelfAlignmentLocal, pref_value); |
1309 profile_->GetPrefs()->SetString(prefs::kShelfAlignment, pref_value); | 1306 profile_->GetPrefs()->SetString(prefs::kShelfAlignment, pref_value); |
1310 } | 1307 } |
(...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2241 | 2238 |
2242 AppIconLoader* ChromeLauncherController::GetAppIconLoaderForApp( | 2239 AppIconLoader* ChromeLauncherController::GetAppIconLoaderForApp( |
2243 const std::string& app_id) { | 2240 const std::string& app_id) { |
2244 for (const auto& app_icon_loader : app_icon_loaders_) { | 2241 for (const auto& app_icon_loader : app_icon_loaders_) { |
2245 if (app_icon_loader->CanLoadImageForApp(app_id)) | 2242 if (app_icon_loader->CanLoadImageForApp(app_id)) |
2246 return app_icon_loader.get(); | 2243 return app_icon_loader.get(); |
2247 } | 2244 } |
2248 | 2245 |
2249 return nullptr; | 2246 return nullptr; |
2250 } | 2247 } |
OLD | NEW |