| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/views/ash/launcher/chrome_launcher_controller.h" | 5 #include "chrome/browser/ui/views/ash/launcher/chrome_launcher_controller.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/launcher/launcher_model.h" | 10 #include "ash/launcher/launcher_model.h" |
| 11 #include "ash/launcher/launcher_types.h" | 11 #include "ash/launcher/launcher_types.h" |
| 12 #include "ash/shell.h" | 12 #include "ash/shell.h" |
| 13 #include "ash/wm/window_util.h" | 13 #include "ash/wm/window_util.h" |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
| 16 #include "base/values.h" | 16 #include "base/values.h" |
| 17 #include "chrome/browser/defaults.h" | 17 #include "chrome/browser/defaults.h" |
| 18 #include "chrome/browser/extensions/extension_service.h" | 18 #include "chrome/browser/extensions/extension_service.h" |
| 19 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 19 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| 20 #include "chrome/browser/prefs/pref_service.h" | 20 #include "chrome/browser/prefs/pref_service.h" |
| 21 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 21 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
| 22 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
| 23 #include "chrome/browser/profiles/profile_manager.h" | 23 #include "chrome/browser/profiles/profile_manager.h" |
| 24 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" | 24 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" |
| 25 #include "chrome/browser/ui/browser.h" | 25 #include "chrome/browser/ui/browser.h" |
| 26 #include "chrome/browser/ui/browser_finder.h" | 26 #include "chrome/browser/ui/browser_finder.h" |
| 27 #include "chrome/browser/ui/browser_window.h" | 27 #include "chrome/browser/ui/browser_window.h" |
| 28 #include "chrome/browser/ui/extensions/shell_window.h" | 28 #include "chrome/browser/ui/extensions/shell_window.h" |
| 29 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 29 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 30 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 30 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 31 #include "chrome/browser/ui/views/ash/extension_utils.h" | 31 #include "chrome/browser/ui/views/ash/extension_utils.h" |
| 32 #include "chrome/browser/ui/views/ash/launcher/browser_launcher_item_controller.
h" | 32 #include "chrome/browser/ui/views/ash/launcher/browser_launcher_item_controller.
h" |
| 33 #include "chrome/browser/ui/views/ash/launcher/launcher_app_icon_loader.h" | 33 #include "chrome/browser/ui/views/ash/launcher/launcher_app_icon_loader.h" |
| 34 #include "chrome/browser/ui/views/ash/launcher/launcher_context_menu.h" | 34 #include "chrome/browser/ui/views/ash/launcher/launcher_context_menu.h" |
| 35 #include "chrome/browser/web_applications/web_app.h" | 35 #include "chrome/browser/web_applications/web_app.h" |
| 36 #include "chrome/common/chrome_notification_types.h" | 36 #include "chrome/common/chrome_notification_types.h" |
| 37 #include "chrome/common/extensions/extension.h" | 37 #include "chrome/common/extensions/extension.h" |
| 38 #include "chrome/common/extensions/extension_resource.h" | 38 #include "chrome/common/extensions/extension_resource.h" |
| 39 #include "chrome/common/pref_names.h" | 39 #include "chrome/common/pref_names.h" |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 } | 246 } |
| 247 | 247 |
| 248 ExtensionPrefs::LaunchType ChromeLauncherController::GetLaunchType( | 248 ExtensionPrefs::LaunchType ChromeLauncherController::GetLaunchType( |
| 249 ash::LauncherID id) { | 249 ash::LauncherID id) { |
| 250 DCHECK(id_to_item_map_.find(id) != id_to_item_map_.end()); | 250 DCHECK(id_to_item_map_.find(id) != id_to_item_map_.end()); |
| 251 | 251 |
| 252 return profile_->GetExtensionService()->extension_prefs()->GetLaunchType( | 252 return profile_->GetExtensionService()->extension_prefs()->GetLaunchType( |
| 253 id_to_item_map_[id].app_id, ExtensionPrefs::LAUNCH_DEFAULT); | 253 id_to_item_map_[id].app_id, ExtensionPrefs::LAUNCH_DEFAULT); |
| 254 } | 254 } |
| 255 | 255 |
| 256 std::string ChromeLauncherController::GetAppID(TabContentsWrapper* tab) { | 256 std::string ChromeLauncherController::GetAppID(TabContents* tab) { |
| 257 return app_icon_loader_->GetAppID(tab); | 257 return app_icon_loader_->GetAppID(tab); |
| 258 } | 258 } |
| 259 | 259 |
| 260 void ChromeLauncherController::SetAppImage(const std::string& id, | 260 void ChromeLauncherController::SetAppImage(const std::string& id, |
| 261 const SkBitmap* image) { | 261 const SkBitmap* image) { |
| 262 // TODO: need to get this working for shortcuts. | 262 // TODO: need to get this working for shortcuts. |
| 263 | 263 |
| 264 for (IDToItemMap::const_iterator i = id_to_item_map_.begin(); | 264 for (IDToItemMap::const_iterator i = id_to_item_map_.begin(); |
| 265 i != id_to_item_map_.end(); ++i) { | 265 i != id_to_item_map_.end(); ++i) { |
| 266 if (i->second.app_id != id) | 266 if (i->second.app_id != id) |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 } | 725 } |
| 726 model_->AddAt(index, item); | 726 model_->AddAt(index, item); |
| 727 | 727 |
| 728 if (!controller || controller->type() != | 728 if (!controller || controller->type() != |
| 729 BrowserLauncherItemController::TYPE_EXTENSION_PANEL) { | 729 BrowserLauncherItemController::TYPE_EXTENSION_PANEL) { |
| 730 if (item.status != ash::STATUS_IS_PENDING) | 730 if (item.status != ash::STATUS_IS_PENDING) |
| 731 app_icon_loader_->FetchImage(app_id); | 731 app_icon_loader_->FetchImage(app_id); |
| 732 } | 732 } |
| 733 return id; | 733 return id; |
| 734 } | 734 } |
| OLD | NEW |