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/chrome_mash_shelf_controller.h" | 5 #include "chrome/browser/ui/ash/launcher/chrome_mash_shelf_controller.h" |
6 | 6 |
7 #include "chrome/browser/extensions/extension_app_icon_loader.h" | 7 #include "chrome/browser/extensions/extension_app_icon_loader.h" |
8 #include "chrome/browser/profiles/profile_manager.h" | 8 #include "chrome/browser/profiles/profile_manager.h" |
9 #include "chrome/browser/ui/app_list/arc/arc_app_icon_loader.h" | 9 #include "chrome/browser/ui/app_list/arc/arc_app_icon_loader.h" |
10 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" | 10 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 | 65 |
66 ChromeMashShelfController::~ChromeMashShelfController() {} | 66 ChromeMashShelfController::~ChromeMashShelfController() {} |
67 | 67 |
68 void ChromeMashShelfController::LaunchItem(const std::string& app_id) { | 68 void ChromeMashShelfController::LaunchItem(const std::string& app_id) { |
69 helper_.LaunchApp(app_id, ash::LAUNCH_FROM_UNKNOWN, ui::EF_NONE); | 69 helper_.LaunchApp(app_id, ash::LAUNCH_FROM_UNKNOWN, ui::EF_NONE); |
70 } | 70 } |
71 | 71 |
72 void ChromeMashShelfController::Init() { | 72 void ChromeMashShelfController::Init() { |
73 shell::Connector* connector = | 73 shell::Connector* connector = |
74 content::MojoShellConnection::GetForProcess()->GetConnector(); | 74 content::MojoShellConnection::GetForProcess()->GetConnector(); |
75 connector->ConnectToInterface("mojo:ash_sysui", &shelf_controller_); | 75 connector->ConnectToInterface("mojo:ash", &shelf_controller_); |
76 | 76 |
77 // Set shelf alignment and auto-hide behavior from preferences. | 77 // Set shelf alignment and auto-hide behavior from preferences. |
78 Profile* profile = ProfileManager::GetActiveUserProfile(); | 78 Profile* profile = ProfileManager::GetActiveUserProfile(); |
79 int64_t display_id = display::Screen::GetScreen()->GetPrimaryDisplay().id(); | 79 int64_t display_id = display::Screen::GetScreen()->GetPrimaryDisplay().id(); |
80 shelf_controller_->SetAlignment(static_cast<mash::shelf::mojom::Alignment>( | 80 shelf_controller_->SetAlignment(static_cast<mash::shelf::mojom::Alignment>( |
81 ash::launcher::GetShelfAlignmentPref(profile->GetPrefs(), display_id))); | 81 ash::launcher::GetShelfAlignmentPref(profile->GetPrefs(), display_id))); |
82 shelf_controller_->SetAutoHideBehavior( | 82 shelf_controller_->SetAutoHideBehavior( |
83 static_cast<mash::shelf::mojom::AutoHideBehavior>( | 83 static_cast<mash::shelf::mojom::AutoHideBehavior>( |
84 ash::launcher::GetShelfAutoHideBehaviorPref(profile->GetPrefs(), | 84 ash::launcher::GetShelfAutoHideBehaviorPref(profile->GetPrefs(), |
85 display_id))); | 85 display_id))); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 ash::launcher::SetShelfAutoHideBehaviorPref( | 161 ash::launcher::SetShelfAutoHideBehaviorPref( |
162 ProfileManager::GetActiveUserProfile()->GetPrefs(), | 162 ProfileManager::GetActiveUserProfile()->GetPrefs(), |
163 display::Screen::GetScreen()->GetPrimaryDisplay().id(), | 163 display::Screen::GetScreen()->GetPrimaryDisplay().id(), |
164 static_cast<ash::ShelfAutoHideBehavior>(auto_hide)); | 164 static_cast<ash::ShelfAutoHideBehavior>(auto_hide)); |
165 } | 165 } |
166 | 166 |
167 void ChromeMashShelfController::OnAppImageUpdated(const std::string& app_id, | 167 void ChromeMashShelfController::OnAppImageUpdated(const std::string& app_id, |
168 const gfx::ImageSkia& image) { | 168 const gfx::ImageSkia& image) { |
169 shelf_controller_->SetItemImage(app_id, *image.bitmap()); | 169 shelf_controller_->SetItemImage(app_id, *image.bitmap()); |
170 } | 170 } |
OLD | NEW |