| 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_impl.h" | 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "ash/common/ash_switches.h" | 11 #include "ash/common/ash_switches.h" |
| 12 #include "ash/common/multi_profile_uma.h" | 12 #include "ash/common/multi_profile_uma.h" |
| 13 #include "ash/common/shelf/shelf_model.h" | 13 #include "ash/common/shelf/shelf_model.h" |
| 14 #include "ash/common/system/tray/system_tray_delegate.h" | 14 #include "ash/common/system/tray/system_tray_delegate.h" |
| 15 #include "ash/common/wm_shell.h" | 15 #include "ash/common/wm_shell.h" |
| 16 #include "ash/common/wm_window.h" |
| 16 #include "ash/root_window_controller.h" | 17 #include "ash/root_window_controller.h" |
| 17 #include "ash/shelf/shelf.h" | 18 #include "ash/shelf/shelf.h" |
| 18 #include "ash/shell.h" | 19 #include "ash/shell.h" |
| 19 #include "ash/wm/window_util.h" | 20 #include "ash/wm/window_util.h" |
| 20 #include "base/command_line.h" | 21 #include "base/command_line.h" |
| 21 #include "base/macros.h" | 22 #include "base/macros.h" |
| 22 #include "base/strings/pattern.h" | 23 #include "base/strings/pattern.h" |
| 23 #include "base/strings/string_util.h" | 24 #include "base/strings/string_util.h" |
| 24 #include "base/strings/utf_string_conversions.h" | 25 #include "base/strings/utf_string_conversions.h" |
| 25 #include "base/threading/thread_task_runner_handle.h" | 26 #include "base/threading/thread_task_runner_handle.h" |
| (...skipping 1276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1302 int target_index = FindInsertionPoint(); | 1303 int target_index = FindInsertionPoint(); |
| 1303 ash::ShelfID id = GetShelfIDForAppID(*pref_app_id); | 1304 ash::ShelfID id = GetShelfIDForAppID(*pref_app_id); |
| 1304 int source_index = model_->ItemIndexByID(id); | 1305 int source_index = model_->ItemIndexByID(id); |
| 1305 if (source_index != target_index) | 1306 if (source_index != target_index) |
| 1306 model_->Move(source_index, target_index); | 1307 model_->Move(source_index, target_index); |
| 1307 } | 1308 } |
| 1308 } | 1309 } |
| 1309 } | 1310 } |
| 1310 | 1311 |
| 1311 void ChromeLauncherControllerImpl::SetShelfAutoHideBehaviorFromPrefs() { | 1312 void ChromeLauncherControllerImpl::SetShelfAutoHideBehaviorFromPrefs() { |
| 1312 for (auto* window : ash::Shell::GetAllRootWindows()) { | 1313 for (ash::WmWindow* window : ash::WmShell::Get()->GetAllRootWindows()) { |
| 1313 ash::Shelf* shelf = ash::Shelf::ForWindow(window); | 1314 ash::Shelf* shelf = ash::Shelf::ForWindow(window); |
| 1314 if (shelf) { | 1315 if (shelf) { |
| 1315 shelf->SetAutoHideBehavior(ash::launcher::GetShelfAutoHideBehaviorPref( | 1316 shelf->SetAutoHideBehavior(ash::launcher::GetShelfAutoHideBehaviorPref( |
| 1316 profile_->GetPrefs(), GetDisplayIDForShelf(shelf))); | 1317 profile_->GetPrefs(), GetDisplayIDForShelf(shelf))); |
| 1317 } | 1318 } |
| 1318 } | 1319 } |
| 1319 } | 1320 } |
| 1320 | 1321 |
| 1321 void ChromeLauncherControllerImpl::SetShelfAlignmentFromPrefs() { | 1322 void ChromeLauncherControllerImpl::SetShelfAlignmentFromPrefs() { |
| 1322 if (!ash::ShelfWidget::ShelfAlignmentAllowed()) | 1323 if (!ash::ShelfWidget::ShelfAlignmentAllowed()) |
| 1323 return; | 1324 return; |
| 1324 | 1325 |
| 1325 for (auto* window : ash::Shell::GetAllRootWindows()) { | 1326 for (ash::WmWindow* window : ash::WmShell::Get()->GetAllRootWindows()) { |
| 1326 ash::Shelf* shelf = ash::Shelf::ForWindow(window); | 1327 ash::Shelf* shelf = ash::Shelf::ForWindow(window); |
| 1327 if (shelf) { | 1328 if (shelf) { |
| 1328 shelf->SetAlignment(ash::launcher::GetShelfAlignmentPref( | 1329 shelf->SetAlignment(ash::launcher::GetShelfAlignmentPref( |
| 1329 profile_->GetPrefs(), GetDisplayIDForShelf(shelf))); | 1330 profile_->GetPrefs(), GetDisplayIDForShelf(shelf))); |
| 1330 } | 1331 } |
| 1331 } | 1332 } |
| 1332 } | 1333 } |
| 1333 | 1334 |
| 1334 void ChromeLauncherControllerImpl::SetShelfBehaviorsFromPrefs() { | 1335 void ChromeLauncherControllerImpl::SetShelfBehaviorsFromPrefs() { |
| 1335 SetShelfAutoHideBehaviorFromPrefs(); | 1336 SetShelfAutoHideBehaviorFromPrefs(); |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1679 if (index == -1) | 1680 if (index == -1) |
| 1680 continue; | 1681 continue; |
| 1681 ash::ShelfItem item = model_->items()[index]; | 1682 ash::ShelfItem item = model_->items()[index]; |
| 1682 item.image = image; | 1683 item.image = image; |
| 1683 if (arc_deferred_launcher_) | 1684 if (arc_deferred_launcher_) |
| 1684 arc_deferred_launcher_->MaybeApplySpinningEffect(id, &item.image); | 1685 arc_deferred_launcher_->MaybeApplySpinningEffect(id, &item.image); |
| 1685 model_->Set(index, item); | 1686 model_->Set(index, item); |
| 1686 // It's possible we're waiting on more than one item, so don't break. | 1687 // It's possible we're waiting on more than one item, so don't break. |
| 1687 } | 1688 } |
| 1688 } | 1689 } |
| OLD | NEW |