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/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" | 9 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" |
| 10 #include "chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.h" | 10 #include "chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.h" |
| 11 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_v2app.h" | 11 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_v2app.h" |
| 12 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 12 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
| 13 #include "chrome/browser/ui/ash/launcher/launcher_application_menu_item_model.h" | 13 #include "chrome/browser/ui/ash/launcher/launcher_application_menu_item_model.h" |
| 14 #include "ui/aura/window.h" | 14 #include "ui/aura/window.h" |
| 15 #include "ui/base/base_window.h" | 15 #include "ui/base/base_window.h" |
| 16 | 16 |
| 17 ArcAppWindowLauncherItemController::ArcAppWindowLauncherItemController( | 17 ArcAppWindowLauncherItemController::ArcAppWindowLauncherItemController( |
| 18 const std::string& arc_app_id, | 18 const std::string& arc_app_id, |
| 19 ChromeLauncherController* controller) | 19 ChromeLauncherController* controller) |
| 20 : AppWindowLauncherItemController(TYPE_APP, | 20 : AppWindowLauncherItemController(TYPE_APP, |
| 21 arc_app_id, | 21 arc_app_id, |
| 22 arc_app_id, | 22 arc_app_id, |
| 23 controller) {} | 23 controller) {} |
| 24 | 24 |
| 25 ArcAppWindowLauncherItemController::~ArcAppWindowLauncherItemController() {} | 25 ArcAppWindowLauncherItemController::~ArcAppWindowLauncherItemController() {} |
| 26 | 26 |
| 27 ash::ShelfItemDelegate::PerformedAction | |
| 28 ArcAppWindowLauncherItemController::ItemSelected(const ui::Event& eent) { | |
|
Mr4D (OOO till 08-26)
2016/08/26 22:54:43
eent -> event?
khmel
2016/08/29 16:41:04
Done.
| |
| 29 if (window_count()) { | |
| 30 return AppWindowLauncherItemController::ItemSelected(eent); | |
| 31 } else { | |
| 32 Launch(ash::LAUNCH_FROM_UNKNOWN, 0); | |
| 33 return kNewWindowCreated; | |
| 34 } | |
| 35 } | |
| 36 | |
| 27 base::string16 ArcAppWindowLauncherItemController::GetTitle() { | 37 base::string16 ArcAppWindowLauncherItemController::GetTitle() { |
| 28 ArcAppListPrefs* arc_prefs = | 38 ArcAppListPrefs* arc_prefs = |
| 29 ArcAppListPrefs::Get(launcher_controller()->GetProfile()); | 39 ArcAppListPrefs::Get(launcher_controller()->GetProfile()); |
| 30 DCHECK(arc_prefs); | 40 DCHECK(arc_prefs); |
| 31 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = arc_prefs->GetApp( | 41 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = arc_prefs->GetApp( |
| 32 ArcAppWindowLauncherController::GetArcAppIdFromShelfAppId(app_id())); | 42 ArcAppWindowLauncherController::GetArcAppIdFromShelfAppId(app_id())); |
| 33 if (!app_info) { | 43 if (!app_info) { |
| 34 NOTREACHED(); | 44 NOTREACHED(); |
| 35 return base::string16(); | 45 return base::string16(); |
| 36 } | 46 } |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 51 for (auto it = windows().begin(); it != windows().end(); ++it, ++i) { | 61 for (auto it = windows().begin(); it != windows().end(); ++it, ++i) { |
| 52 // TODO(khmel): resolve correct icon here. | 62 // TODO(khmel): resolve correct icon here. |
| 53 gfx::Image image; | 63 gfx::Image image; |
| 54 aura::Window* window = (*it)->GetNativeWindow(); | 64 aura::Window* window = (*it)->GetNativeWindow(); |
| 55 items.push_back(new ChromeLauncherAppMenuItemV2App( | 65 items.push_back(new ChromeLauncherAppMenuItemV2App( |
| 56 (window ? window->title() : GetTitle()), &image, app_id(), | 66 (window ? window->title() : GetTitle()), &image, app_id(), |
| 57 launcher_controller(), i, i == 0 /* has_leading_separator */)); | 67 launcher_controller(), i, i == 0 /* has_leading_separator */)); |
| 58 } | 68 } |
| 59 return items; | 69 return items; |
| 60 } | 70 } |
| OLD | NEW |