| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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.h" | 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
| 10 #include "ash/desktop_background/desktop_background_controller.h" | 10 #include "ash/desktop_background/desktop_background_controller.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 #include "chrome/browser/ui/ash/launcher/launcher_app_tab_helper.h" | 49 #include "chrome/browser/ui/ash/launcher/launcher_app_tab_helper.h" |
| 50 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h" | 50 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h" |
| 51 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" | 51 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" |
| 52 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" | 52 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" |
| 53 #include "chrome/browser/ui/browser.h" | 53 #include "chrome/browser/ui/browser.h" |
| 54 #include "chrome/browser/ui/browser_commands.h" | 54 #include "chrome/browser/ui/browser_commands.h" |
| 55 #include "chrome/browser/ui/browser_finder.h" | 55 #include "chrome/browser/ui/browser_finder.h" |
| 56 #include "chrome/browser/ui/browser_list.h" | 56 #include "chrome/browser/ui/browser_list.h" |
| 57 #include "chrome/browser/ui/browser_tabstrip.h" | 57 #include "chrome/browser/ui/browser_tabstrip.h" |
| 58 #include "chrome/browser/ui/browser_window.h" | 58 #include "chrome/browser/ui/browser_window.h" |
| 59 #include "chrome/browser/ui/extensions/app_launch_params.h" |
| 59 #include "chrome/browser/ui/extensions/application_launch.h" | 60 #include "chrome/browser/ui/extensions/application_launch.h" |
| 60 #include "chrome/browser/ui/extensions/extension_enable_flow.h" | 61 #include "chrome/browser/ui/extensions/extension_enable_flow.h" |
| 61 #include "chrome/browser/ui/host_desktop.h" | 62 #include "chrome/browser/ui/host_desktop.h" |
| 62 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 63 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 63 #include "chrome/browser/web_applications/web_app.h" | 64 #include "chrome/browser/web_applications/web_app.h" |
| 64 #include "chrome/common/chrome_switches.h" | 65 #include "chrome/common/chrome_switches.h" |
| 65 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" | 66 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" |
| 66 #include "chrome/common/pref_names.h" | 67 #include "chrome/common/pref_names.h" |
| 67 #include "chrome/common/url_constants.h" | 68 #include "chrome/common/url_constants.h" |
| 68 #include "chrome/grit/generated_resources.h" | 69 #include "chrome/grit/generated_resources.h" |
| 69 #include "content/public/browser/navigation_entry.h" | 70 #include "content/public/browser/navigation_entry.h" |
| 70 #include "content/public/browser/notification_registrar.h" | 71 #include "content/public/browser/notification_registrar.h" |
| 71 #include "content/public/browser/notification_service.h" | 72 #include "content/public/browser/notification_service.h" |
| 72 #include "content/public/browser/web_contents.h" | 73 #include "content/public/browser/web_contents.h" |
| 73 #include "extensions/browser/extension_prefs.h" | 74 #include "extensions/browser/extension_prefs.h" |
| 74 #include "extensions/browser/extension_registry.h" | 75 #include "extensions/browser/extension_registry.h" |
| 75 #include "extensions/browser/extension_system.h" | 76 #include "extensions/browser/extension_system.h" |
| 76 #include "extensions/browser/extension_util.h" | 77 #include "extensions/browser/extension_util.h" |
| 77 #include "extensions/common/constants.h" | 78 #include "extensions/common/constants.h" |
| 78 #include "extensions/common/extension.h" | 79 #include "extensions/common/extension.h" |
| 79 #include "extensions/common/extension_resource.h" | 80 #include "extensions/common/extension_resource.h" |
| 80 #include "extensions/common/manifest_handlers/icons_handler.h" | 81 #include "extensions/common/manifest_handlers/icons_handler.h" |
| 81 #include "extensions/common/url_pattern.h" | 82 #include "extensions/common/url_pattern.h" |
| 82 #include "grit/ash_resources.h" | 83 #include "grit/ash_resources.h" |
| 83 #include "grit/theme_resources.h" | 84 #include "grit/theme_resources.h" |
| 84 #include "net/base/url_util.h" | 85 #include "net/base/url_util.h" |
| 85 #include "ui/aura/window.h" | 86 #include "ui/aura/window.h" |
| 86 #include "ui/aura/window_event_dispatcher.h" | 87 #include "ui/aura/window_event_dispatcher.h" |
| 87 #include "ui/base/l10n/l10n_util.h" | 88 #include "ui/base/l10n/l10n_util.h" |
| 89 #include "ui/base/window_open_disposition.h" |
| 88 #include "ui/keyboard/keyboard_util.h" | 90 #include "ui/keyboard/keyboard_util.h" |
| 89 #include "ui/resources/grit/ui_resources.h" | 91 #include "ui/resources/grit/ui_resources.h" |
| 90 #include "ui/wm/core/window_animations.h" | 92 #include "ui/wm/core/window_animations.h" |
| 91 | 93 |
| 92 #if defined(OS_CHROMEOS) | 94 #if defined(OS_CHROMEOS) |
| 93 #include "chrome/browser/browser_process.h" | 95 #include "chrome/browser/browser_process.h" |
| 94 #include "chrome/browser/ui/ash/chrome_shell_delegate.h" | 96 #include "chrome/browser/ui/ash/chrome_shell_delegate.h" |
| 95 #include "chrome/browser/ui/ash/launcher/multi_profile_app_window_launcher_contr
oller.h" | 97 #include "chrome/browser/ui/ash/launcher/multi_profile_app_window_launcher_contr
oller.h" |
| 96 #include "chrome/browser/ui/ash/launcher/multi_profile_browser_status_monitor.h" | 98 #include "chrome/browser/ui/ash/launcher/multi_profile_browser_status_monitor.h" |
| 97 #include "components/user_manager/user_manager.h" | 99 #include "components/user_manager/user_manager.h" |
| (...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 727 extension_enable_flow_->StartForNativeWindow(NULL); | 729 extension_enable_flow_->StartForNativeWindow(NULL); |
| 728 return; | 730 return; |
| 729 } | 731 } |
| 730 | 732 |
| 731 #if defined(OS_WIN) | 733 #if defined(OS_WIN) |
| 732 if (LaunchedInNativeDesktop(app_id)) | 734 if (LaunchedInNativeDesktop(app_id)) |
| 733 return; | 735 return; |
| 734 #endif | 736 #endif |
| 735 | 737 |
| 736 // The app will be created for the currently active profile. | 738 // The app will be created for the currently active profile. |
| 737 AppLaunchParams params(profile_, | 739 AppLaunchParams params( |
| 738 extension, | 740 profile_, extension, ui::DispositionFromEventFlags(event_flags), |
| 739 event_flags, | 741 chrome::HOST_DESKTOP_TYPE_ASH, extensions::SOURCE_APP_LAUNCHER); |
| 740 chrome::HOST_DESKTOP_TYPE_ASH); | |
| 741 if (source != ash::LAUNCH_FROM_UNKNOWN && | 742 if (source != ash::LAUNCH_FROM_UNKNOWN && |
| 742 app_id == extensions::kWebStoreAppId) { | 743 app_id == extensions::kWebStoreAppId) { |
| 743 // Get the corresponding source string. | 744 // Get the corresponding source string. |
| 744 std::string source_value = GetSourceFromAppListSource(source); | 745 std::string source_value = GetSourceFromAppListSource(source); |
| 745 | 746 |
| 746 // Set an override URL to include the source. | 747 // Set an override URL to include the source. |
| 747 GURL extension_url = extensions::AppLaunchInfo::GetFullLaunchURL(extension); | 748 GURL extension_url = extensions::AppLaunchInfo::GetFullLaunchURL(extension); |
| 748 params.override_url = net::AppendQueryParameter( | 749 params.override_url = net::AppendQueryParameter( |
| 749 extension_url, extension_urls::kWebstoreSourceField, source_value); | 750 extension_url, extension_urls::kWebstoreSourceField, source_value); |
| 750 } | 751 } |
| 751 | 752 |
| 752 params.source = (source == ash::LAUNCH_FROM_UNKNOWN) | |
| 753 ? extensions::SOURCE_UNTRACKED | |
| 754 : extensions::SOURCE_APP_LAUNCHER; | |
| 755 | |
| 756 OpenApplication(params); | 753 OpenApplication(params); |
| 757 } | 754 } |
| 758 | 755 |
| 759 void ChromeLauncherController::ActivateApp(const std::string& app_id, | 756 void ChromeLauncherController::ActivateApp(const std::string& app_id, |
| 760 ash::LaunchSource source, | 757 ash::LaunchSource source, |
| 761 int event_flags) { | 758 int event_flags) { |
| 762 // If there is an existing non-shortcut controller for this app, open it. | 759 // If there is an existing non-shortcut controller for this app, open it. |
| 763 ash::ShelfID id = GetShelfIDForAppID(app_id); | 760 ash::ShelfID id = GetShelfIDForAppID(app_id); |
| 764 if (id) { | 761 if (id) { |
| 765 LauncherItemController* controller = GetLauncherItemController(id); | 762 LauncherItemController* controller = GetLauncherItemController(id); |
| (...skipping 1364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2130 void ChromeLauncherController::ReleaseProfile() { | 2127 void ChromeLauncherController::ReleaseProfile() { |
| 2131 if (app_sync_ui_state_) | 2128 if (app_sync_ui_state_) |
| 2132 app_sync_ui_state_->RemoveObserver(this); | 2129 app_sync_ui_state_->RemoveObserver(this); |
| 2133 | 2130 |
| 2134 extensions::ExtensionRegistry::Get(profile_)->RemoveObserver(this); | 2131 extensions::ExtensionRegistry::Get(profile_)->RemoveObserver(this); |
| 2135 | 2132 |
| 2136 PrefServiceSyncable::FromProfile(profile_)->RemoveObserver(this); | 2133 PrefServiceSyncable::FromProfile(profile_)->RemoveObserver(this); |
| 2137 | 2134 |
| 2138 pref_change_registrar_.RemoveAll(); | 2135 pref_change_registrar_.RemoveAll(); |
| 2139 } | 2136 } |
| OLD | NEW |