Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/arc_app_window_launcher_item_controller .h" | 5 #include "chrome/browser/ui/ash/launcher/arc_app_window_launcher_item_controller .h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" | 10 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" |
| 11 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" | 11 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" |
| 12 #include "chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.h" | 12 #include "chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.h" |
| 13 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_v2app.h" | |
| 14 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 13 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
| 15 #include "chrome/browser/ui/ash/launcher/launcher_controller_helper.h" | 14 #include "chrome/browser/ui/ash/launcher/launcher_controller_helper.h" |
| 16 #include "ui/aura/window.h" | 15 #include "ui/aura/window.h" |
| 17 #include "ui/base/base_window.h" | 16 #include "ui/base/base_window.h" |
| 18 | 17 |
| 19 ArcAppWindowLauncherItemController::ArcAppWindowLauncherItemController( | 18 ArcAppWindowLauncherItemController::ArcAppWindowLauncherItemController( |
| 20 const std::string& arc_app_id, | 19 const std::string& arc_app_id, |
| 21 ChromeLauncherController* controller) | 20 ChromeLauncherController* controller) |
| 22 : AppWindowLauncherItemController(arc_app_id, std::string(), controller) {} | 21 : AppWindowLauncherItemController(arc_app_id, std::string(), controller) {} |
| 23 | 22 |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 49 NOTREACHED(); | 48 NOTREACHED(); |
| 50 return ash::SHELF_ACTION_NONE; | 49 return ash::SHELF_ACTION_NONE; |
| 51 } | 50 } |
| 52 arc::SetTaskActive(*task_ids_.begin()); | 51 arc::SetTaskActive(*task_ids_.begin()); |
| 53 return ash::SHELF_ACTION_NEW_WINDOW_CREATED; | 52 return ash::SHELF_ACTION_NEW_WINDOW_CREATED; |
| 54 } | 53 } |
| 55 | 54 |
| 56 ash::ShelfAppMenuItemList ArcAppWindowLauncherItemController::GetAppMenuItems( | 55 ash::ShelfAppMenuItemList ArcAppWindowLauncherItemController::GetAppMenuItems( |
| 57 int event_flags) { | 56 int event_flags) { |
| 58 ash::ShelfAppMenuItemList items; | 57 ash::ShelfAppMenuItemList items; |
| 58 CHECK_LT(windows().size(), std::numeric_limits<uint32_t>::max()); | |
|
James Cook
2017/03/02 15:43:00
ditto re: uint16 vs 8 vs other limit
msw
2017/03/02 18:37:47
Removed.
| |
| 59 base::string16 app_title = LauncherControllerHelper::GetAppTitle( | 59 base::string16 app_title = LauncherControllerHelper::GetAppTitle( |
| 60 launcher_controller()->profile(), app_id()); | 60 launcher_controller()->profile(), app_id()); |
| 61 for (auto it = windows().begin(); it != windows().end(); ++it) { | 61 for (auto it = windows().begin(); it != windows().end(); ++it) { |
| 62 // TODO(khmel): resolve correct icon here. | 62 // TODO(khmel): resolve correct icon here. |
| 63 size_t i = std::distance(windows().begin(), it); | 63 size_t i = std::distance(windows().begin(), it); |
| 64 gfx::Image image; | 64 gfx::Image image; |
| 65 aura::Window* window = (*it)->GetNativeWindow(); | 65 aura::Window* window = (*it)->GetNativeWindow(); |
| 66 items.push_back(base::MakeUnique<ChromeLauncherAppMenuItemV2App>( | 66 items.push_back(base::MakeUnique<ash::ShelfApplicationMenuItem>( |
| 67 base::checked_cast<uint32_t>(i), | |
| 67 ((window && !window->GetTitle().empty()) ? window->GetTitle() | 68 ((window && !window->GetTitle().empty()) ? window->GetTitle() |
| 68 : app_title), | 69 : app_title), |
| 69 &image, app_id(), launcher_controller(), i)); | 70 &image)); |
| 70 } | 71 } |
| 71 return items; | 72 return items; |
| 72 } | 73 } |
| OLD | NEW |