Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: chrome/browser/ui/ash/launcher/chrome_mash_shelf_controller.cc

Issue 1960293003: Remove OS_CHROMEOS from ui/ash code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/ash/chrome_launcher_prefs.h" 10 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h"
10 #include "chrome/browser/ui/ash/launcher/chrome_launcher_types.h" 11 #include "chrome/browser/ui/ash/launcher/chrome_launcher_types.h"
11 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h" 12 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h"
12 #include "chrome/grit/theme_resources.h" 13 #include "chrome/grit/theme_resources.h"
13 #include "content/public/common/mojo_shell_connection.h" 14 #include "content/public/common/mojo_shell_connection.h"
14 #include "extensions/common/constants.h" 15 #include "extensions/common/constants.h"
15 #include "extensions/grit/extensions_browser_resources.h" 16 #include "extensions/grit/extensions_browser_resources.h"
16 #include "mojo/common/common_type_converters.h" 17 #include "mojo/common/common_type_converters.h"
17 #include "services/shell/public/cpp/connector.h" 18 #include "services/shell/public/cpp/connector.h"
18 #include "skia/public/type_converters.h" 19 #include "skia/public/type_converters.h"
19 #include "ui/base/resource/resource_bundle.h" 20 #include "ui/base/resource/resource_bundle.h"
20 #include "ui/display/screen.h" 21 #include "ui/display/screen.h"
21 22
22 #if defined(OS_CHROMEOS)
23 #include "chrome/browser/ui/app_list/arc/arc_app_icon_loader.h"
24 #endif
25
26 class ChromeShelfItemDelegate : public mash::shelf::mojom::ShelfItemDelegate { 23 class ChromeShelfItemDelegate : public mash::shelf::mojom::ShelfItemDelegate {
27 public: 24 public:
28 explicit ChromeShelfItemDelegate(const std::string& app_id) 25 explicit ChromeShelfItemDelegate(const std::string& app_id)
29 : app_id_(app_id), item_delegate_binding_(this) {} 26 : app_id_(app_id), item_delegate_binding_(this) {}
30 ~ChromeShelfItemDelegate() override {} 27 ~ChromeShelfItemDelegate() override {}
31 28
32 mash::shelf::mojom::ShelfItemDelegateAssociatedPtrInfo 29 mash::shelf::mojom::ShelfItemDelegateAssociatedPtrInfo
33 CreateInterfacePtrInfoAndBind(mojo::AssociatedGroup* associated_group) { 30 CreateInterfacePtrInfoAndBind(mojo::AssociatedGroup* associated_group) {
34 DCHECK(!item_delegate_binding_.is_bound()); 31 DCHECK(!item_delegate_binding_.is_bound());
35 mash::shelf::mojom::ShelfItemDelegateAssociatedPtrInfo ptr_info; 32 mash::shelf::mojom::ShelfItemDelegateAssociatedPtrInfo ptr_info;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 // TODO(skuhne): The AppIconLoaderImpl has the same problem. Each loaded 91 // TODO(skuhne): The AppIconLoaderImpl has the same problem. Each loaded
95 // image is associated with a profile (its loader requires the profile). 92 // image is associated with a profile (its loader requires the profile).
96 // Since icon size changes are possible, the icon could be requested to be 93 // Since icon size changes are possible, the icon could be requested to be
97 // reloaded. However - having it not multi profile aware would cause problems 94 // reloaded. However - having it not multi profile aware would cause problems
98 // if the icon cache gets deleted upon user switch. 95 // if the icon cache gets deleted upon user switch.
99 std::unique_ptr<AppIconLoader> extension_app_icon_loader( 96 std::unique_ptr<AppIconLoader> extension_app_icon_loader(
100 new extensions::ExtensionAppIconLoader( 97 new extensions::ExtensionAppIconLoader(
101 profile, extension_misc::EXTENSION_ICON_SMALL, this)); 98 profile, extension_misc::EXTENSION_ICON_SMALL, this));
102 app_icon_loaders_.push_back(std::move(extension_app_icon_loader)); 99 app_icon_loaders_.push_back(std::move(extension_app_icon_loader));
103 100
104 #if defined(OS_CHROMEOS)
105 std::unique_ptr<AppIconLoader> arc_app_icon_loader(new ArcAppIconLoader( 101 std::unique_ptr<AppIconLoader> arc_app_icon_loader(new ArcAppIconLoader(
106 profile, extension_misc::EXTENSION_ICON_SMALL, this)); 102 profile, extension_misc::EXTENSION_ICON_SMALL, this));
107 app_icon_loaders_.push_back(std::move(arc_app_icon_loader)); 103 app_icon_loaders_.push_back(std::move(arc_app_icon_loader));
108 #endif
109 104
110 PinAppsFromPrefs(); 105 PinAppsFromPrefs();
111 106
112 // Start observing the shelf now that it has been initialized. 107 // Start observing the shelf now that it has been initialized.
113 mash::shelf::mojom::ShelfObserverAssociatedPtrInfo ptr_info; 108 mash::shelf::mojom::ShelfObserverAssociatedPtrInfo ptr_info;
114 observer_binding_.Bind(&ptr_info, shelf_controller_.associated_group()); 109 observer_binding_.Bind(&ptr_info, shelf_controller_.associated_group());
115 shelf_controller_->AddObserver(std::move(ptr_info)); 110 shelf_controller_->AddObserver(std::move(ptr_info));
116 } 111 }
117 112
118 void ChromeMashShelfController::PinAppsFromPrefs() { 113 void ChromeMashShelfController::PinAppsFromPrefs() {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 ProfileManager::GetActiveUserProfile()->GetPrefs(), 164 ProfileManager::GetActiveUserProfile()->GetPrefs(),
170 display::Screen::GetScreen()->GetPrimaryDisplay().id(), 165 display::Screen::GetScreen()->GetPrimaryDisplay().id(),
171 static_cast<ash::ShelfAutoHideBehavior>(auto_hide)); 166 static_cast<ash::ShelfAutoHideBehavior>(auto_hide));
172 } 167 }
173 168
174 void ChromeMashShelfController::OnAppImageUpdated(const std::string& app_id, 169 void ChromeMashShelfController::OnAppImageUpdated(const std::string& app_id,
175 const gfx::ImageSkia& image) { 170 const gfx::ImageSkia& image) {
176 shelf_controller_->SetItemImage(app_id, 171 shelf_controller_->SetItemImage(app_id,
177 skia::mojom::Bitmap::From(*image.bitmap())); 172 skia::mojom::Bitmap::From(*image.bitmap()));
178 } 173 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698