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" | |
9 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/profiles/profile_manager.h" | 9 #include "chrome/browser/profiles/profile_manager.h" |
11 #include "chrome/browser/ui/ash/app_launcher_id.h" | 10 #include "chrome/browser/ui/ash/app_launcher_id.h" |
12 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" | 11 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" |
13 #include "chrome/browser/ui/ash/launcher/launcher_controller_helper.h" | 12 #include "chrome/browser/ui/ash/launcher/launcher_controller_helper.h" |
14 #include "extensions/grit/extensions_browser_resources.h" | 13 #include "extensions/grit/extensions_browser_resources.h" |
15 #include "ui/base/resource/resource_bundle.h" | 14 #include "ui/base/resource/resource_bundle.h" |
16 #include "ui/events/event_constants.h" | 15 #include "ui/events/event_constants.h" |
17 | 16 |
18 ChromeLauncherControllerMus::ChromeLauncherControllerMus() { | 17 ChromeLauncherControllerMus::ChromeLauncherControllerMus() { |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 ash::launcher::GetPinnedAppsFromPrefs(profile()->GetPrefs(), | 237 ash::launcher::GetPinnedAppsFromPrefs(profile()->GetPrefs(), |
239 launcher_controller_helper()); | 238 launcher_controller_helper()); |
240 | 239 |
241 for (const auto& app_launcher_id : pinned_apps) { | 240 for (const auto& app_launcher_id : pinned_apps) { |
242 const std::string app_id = app_launcher_id.app_id(); | 241 const std::string app_id = app_launcher_id.app_id(); |
243 if (app_launcher_id.app_id() == ash::launcher::kPinnedAppsPlaceholder) | 242 if (app_launcher_id.app_id() == ash::launcher::kPinnedAppsPlaceholder) |
244 continue; | 243 continue; |
245 | 244 |
246 ash::mojom::ShelfItemPtr item(ash::mojom::ShelfItem::New()); | 245 ash::mojom::ShelfItemPtr item(ash::mojom::ShelfItem::New()); |
247 item->app_id = app_id; | 246 item->app_id = app_id; |
248 item->app_title = base::UTF16ToUTF8( | 247 item->title = launcher_controller_helper()->GetAppTitle(profile(), app_id); |
249 launcher_controller_helper()->GetAppTitle(profile(), app_id)); | |
250 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 248 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
251 const gfx::Image& image = rb.GetImageNamed(IDR_APP_DEFAULT_ICON); | 249 const gfx::Image& image = rb.GetImageNamed(IDR_APP_DEFAULT_ICON); |
252 item->image = *image.ToSkBitmap(); | 250 item->image = *image.ToSkBitmap(); |
253 // TOOD(msw): Actually pin the item and install its delegate; this code is | 251 // TOOD(msw): Actually pin the item and install its delegate; this code is |
254 // unused at the moment. See http://crbug.com/647879 | 252 // unused at the moment. See http://crbug.com/647879 |
255 AppIconLoader* app_icon_loader = GetAppIconLoaderForApp(app_id); | 253 AppIconLoader* app_icon_loader = GetAppIconLoaderForApp(app_id); |
256 if (app_icon_loader) { | 254 if (app_icon_loader) { |
257 app_icon_loader->FetchImage(app_id); | 255 app_icon_loader->FetchImage(app_id); |
258 app_icon_loader->UpdateImage(app_id); | 256 app_icon_loader->UpdateImage(app_id); |
259 } | 257 } |
260 } | 258 } |
261 } | 259 } |
OLD | NEW |