| 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_launcher_controller_mus.h" | 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_mus.h" |
| 6 | 6 |
| 7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_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/profiles/profile_manager.h" | 10 #include "chrome/browser/profiles/profile_manager.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 mojo::AssociatedGroup* associated_group) { | 28 mojo::AssociatedGroup* associated_group) { |
| 29 DCHECK(!item_delegate_binding_.is_bound()); | 29 DCHECK(!item_delegate_binding_.is_bound()); |
| 30 ash::mojom::ShelfItemDelegateAssociatedPtrInfo ptr_info; | 30 ash::mojom::ShelfItemDelegateAssociatedPtrInfo ptr_info; |
| 31 item_delegate_binding_.Bind(&ptr_info, associated_group); | 31 item_delegate_binding_.Bind(&ptr_info, associated_group); |
| 32 return ptr_info; | 32 return ptr_info; |
| 33 } | 33 } |
| 34 | 34 |
| 35 private: | 35 private: |
| 36 // ash::mojom::ShelfItemDelegate: | 36 // ash::mojom::ShelfItemDelegate: |
| 37 void LaunchItem() override { | 37 void LaunchItem() override { |
| 38 controller_->LaunchApp(ash::launcher::AppLauncherId(app_id_), | 38 controller_->LaunchApp(ash::AppLauncherId(app_id_), |
| 39 ash::LAUNCH_FROM_UNKNOWN, ui::EF_NONE); | 39 ash::LAUNCH_FROM_UNKNOWN, ui::EF_NONE); |
| 40 } | 40 } |
| 41 void ExecuteCommand(uint32_t command_id, int32_t event_flags) override { | 41 void ExecuteCommand(uint32_t command_id, int32_t event_flags) override { |
| 42 NOTIMPLEMENTED(); | 42 NOTIMPLEMENTED(); |
| 43 } | 43 } |
| 44 void ItemPinned() override { NOTIMPLEMENTED(); } | 44 void ItemPinned() override { NOTIMPLEMENTED(); } |
| 45 void ItemUnpinned() override { NOTIMPLEMENTED(); } | 45 void ItemUnpinned() override { NOTIMPLEMENTED(); } |
| 46 void ItemReordered(uint32_t order) override { NOTIMPLEMENTED(); } | 46 void ItemReordered(uint32_t order) override { NOTIMPLEMENTED(); } |
| 47 | 47 |
| 48 std::string app_id_; | 48 std::string app_id_; |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 if (ConnectToShelfController()) | 268 if (ConnectToShelfController()) |
| 269 shelf_controller()->SetItemImage(app_id, *image.bitmap()); | 269 shelf_controller()->SetItemImage(app_id, *image.bitmap()); |
| 270 } | 270 } |
| 271 | 271 |
| 272 void ChromeLauncherControllerMus::OnInit() {} | 272 void ChromeLauncherControllerMus::OnInit() {} |
| 273 | 273 |
| 274 void ChromeLauncherControllerMus::PinAppsFromPrefs() { | 274 void ChromeLauncherControllerMus::PinAppsFromPrefs() { |
| 275 if (!ConnectToShelfController()) | 275 if (!ConnectToShelfController()) |
| 276 return; | 276 return; |
| 277 | 277 |
| 278 std::vector<ash::launcher::AppLauncherId> pinned_apps = | 278 std::vector<ash::AppLauncherId> pinned_apps = |
| 279 ash::launcher::GetPinnedAppsFromPrefs(profile()->GetPrefs(), | 279 ash::launcher::GetPinnedAppsFromPrefs(profile()->GetPrefs(), |
| 280 launcher_controller_helper()); | 280 launcher_controller_helper()); |
| 281 | 281 |
| 282 for (const auto& app_launcher_id : pinned_apps) { | 282 for (const auto& app_launcher_id : pinned_apps) { |
| 283 const std::string app_id = app_launcher_id.app_id(); | 283 const std::string app_id = app_launcher_id.app_id(); |
| 284 if (app_launcher_id.app_id() == ash::launcher::kPinnedAppsPlaceholder) | 284 if (app_launcher_id.app_id() == ash::launcher::kPinnedAppsPlaceholder) |
| 285 continue; | 285 continue; |
| 286 | 286 |
| 287 ash::mojom::ShelfItemPtr item(ash::mojom::ShelfItem::New()); | 287 ash::mojom::ShelfItemPtr item(ash::mojom::ShelfItem::New()); |
| 288 item->app_id = app_id; | 288 item->app_id = app_id; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 299 app_id_to_item_delegate_.insert( | 299 app_id_to_item_delegate_.insert( |
| 300 std::make_pair(app_id, std::move(delegate))); | 300 std::make_pair(app_id, std::move(delegate))); |
| 301 | 301 |
| 302 AppIconLoader* app_icon_loader = GetAppIconLoaderForApp(app_id); | 302 AppIconLoader* app_icon_loader = GetAppIconLoaderForApp(app_id); |
| 303 if (app_icon_loader) { | 303 if (app_icon_loader) { |
| 304 app_icon_loader->FetchImage(app_id); | 304 app_icon_loader->FetchImage(app_id); |
| 305 app_icon_loader->UpdateImage(app_id); | 305 app_icon_loader->UpdateImage(app_id); |
| 306 } | 306 } |
| 307 } | 307 } |
| 308 } | 308 } |
| OLD | NEW |