| 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" | 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" | 14 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
| 15 #include "chrome/browser/ui/ash/launcher/launcher_application_menu_item_model.h" | |
| 16 #include "chrome/browser/ui/ash/launcher/launcher_controller_helper.h" | 15 #include "chrome/browser/ui/ash/launcher/launcher_controller_helper.h" |
| 17 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
| 18 #include "ui/base/base_window.h" | 17 #include "ui/base/base_window.h" |
| 19 | 18 |
| 20 ArcAppWindowLauncherItemController::ArcAppWindowLauncherItemController( | 19 ArcAppWindowLauncherItemController::ArcAppWindowLauncherItemController( |
| 21 const std::string& arc_app_id, | 20 const std::string& arc_app_id, |
| 22 ChromeLauncherController* controller) | 21 ChromeLauncherController* controller) |
| 23 : AppWindowLauncherItemController(arc_app_id, "", controller) {} | 22 : AppWindowLauncherItemController(arc_app_id, "", controller) {} |
| 24 | 23 |
| 25 ArcAppWindowLauncherItemController::~ArcAppWindowLauncherItemController() {} | 24 ArcAppWindowLauncherItemController::~ArcAppWindowLauncherItemController() {} |
| (...skipping 17 matching lines...) Expand all Loading... |
| 43 } else { | 42 } else { |
| 44 if (task_ids_.empty()) { | 43 if (task_ids_.empty()) { |
| 45 NOTREACHED(); | 44 NOTREACHED(); |
| 46 return kNoAction; | 45 return kNoAction; |
| 47 } | 46 } |
| 48 arc::SetTaskActive(*task_ids_.begin()); | 47 arc::SetTaskActive(*task_ids_.begin()); |
| 49 return kNewWindowCreated; | 48 return kNewWindowCreated; |
| 50 } | 49 } |
| 51 } | 50 } |
| 52 | 51 |
| 53 ChromeLauncherAppMenuItems | 52 ash::ShelfAppMenuItemList ArcAppWindowLauncherItemController::GetAppMenuItems( |
| 54 ArcAppWindowLauncherItemController::GetApplicationList(int event_flags) { | 53 int event_flags) { |
| 55 ChromeLauncherAppMenuItems items = | 54 ash::ShelfAppMenuItemList items; |
| 56 AppWindowLauncherItemController::GetApplicationList(event_flags); | |
| 57 base::string16 app_title = LauncherControllerHelper::GetAppTitle( | 55 base::string16 app_title = LauncherControllerHelper::GetAppTitle( |
| 58 launcher_controller()->profile(), app_id()); | 56 launcher_controller()->profile(), app_id()); |
| 59 for (auto it = windows().begin(); it != windows().end(); ++it) { | 57 for (auto it = windows().begin(); it != windows().end(); ++it) { |
| 60 // TODO(khmel): resolve correct icon here. | 58 // TODO(khmel): resolve correct icon here. |
| 61 size_t i = std::distance(windows().begin(), it); | 59 size_t i = std::distance(windows().begin(), it); |
| 62 gfx::Image image; | 60 gfx::Image image; |
| 63 aura::Window* window = (*it)->GetNativeWindow(); | 61 aura::Window* window = (*it)->GetNativeWindow(); |
| 64 items.push_back(base::MakeUnique<ChromeLauncherAppMenuItemV2App>( | 62 items.push_back(base::MakeUnique<ChromeLauncherAppMenuItemV2App>( |
| 65 ((window && !window->GetTitle().empty()) ? window->GetTitle() | 63 ((window && !window->GetTitle().empty()) ? window->GetTitle() |
| 66 : app_title), | 64 : app_title), |
| 67 &image, app_id(), launcher_controller(), i, | 65 &image, app_id(), launcher_controller(), i)); |
| 68 i == 0 /* has_leading_separator */)); | |
| 69 } | 66 } |
| 70 return items; | 67 return items; |
| 71 } | 68 } |
| OLD | NEW |