| 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" |
| (...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 727 extension_enable_flow_->StartForNativeWindow(NULL); | 728 extension_enable_flow_->StartForNativeWindow(NULL); |
| 728 return; | 729 return; |
| 729 } | 730 } |
| 730 | 731 |
| 731 #if defined(OS_WIN) | 732 #if defined(OS_WIN) |
| 732 if (LaunchedInNativeDesktop(app_id)) | 733 if (LaunchedInNativeDesktop(app_id)) |
| 733 return; | 734 return; |
| 734 #endif | 735 #endif |
| 735 | 736 |
| 736 // The app will be created for the currently active profile. | 737 // The app will be created for the currently active profile. |
| 737 AppLaunchParams params(profile_, | 738 AppLaunchParams params(profile_, extension, event_flags, |
| 738 extension, | 739 chrome::HOST_DESKTOP_TYPE_ASH, |
| 739 event_flags, | 740 extensions::SOURCE_APP_LAUNCHER); |
| 740 chrome::HOST_DESKTOP_TYPE_ASH); | |
| 741 if (source != ash::LAUNCH_FROM_UNKNOWN && | 741 if (source != ash::LAUNCH_FROM_UNKNOWN && |
| 742 app_id == extensions::kWebStoreAppId) { | 742 app_id == extensions::kWebStoreAppId) { |
| 743 // Get the corresponding source string. | 743 // Get the corresponding source string. |
| 744 std::string source_value = GetSourceFromAppListSource(source); | 744 std::string source_value = GetSourceFromAppListSource(source); |
| 745 | 745 |
| 746 // Set an override URL to include the source. | 746 // Set an override URL to include the source. |
| 747 GURL extension_url = extensions::AppLaunchInfo::GetFullLaunchURL(extension); | 747 GURL extension_url = extensions::AppLaunchInfo::GetFullLaunchURL(extension); |
| 748 params.override_url = net::AppendQueryParameter( | 748 params.override_url = net::AppendQueryParameter( |
| 749 extension_url, extension_urls::kWebstoreSourceField, source_value); | 749 extension_url, extension_urls::kWebstoreSourceField, source_value); |
| 750 } | 750 } |
| 751 | 751 |
| 752 params.source = (source == ash::LAUNCH_FROM_UNKNOWN) | |
| 753 ? extensions::SOURCE_UNTRACKED | |
| 754 : extensions::SOURCE_APP_LAUNCHER; | |
| 755 | |
| 756 OpenApplication(params); | 752 OpenApplication(params); |
| 757 } | 753 } |
| 758 | 754 |
| 759 void ChromeLauncherController::ActivateApp(const std::string& app_id, | 755 void ChromeLauncherController::ActivateApp(const std::string& app_id, |
| 760 ash::LaunchSource source, | 756 ash::LaunchSource source, |
| 761 int event_flags) { | 757 int event_flags) { |
| 762 // If there is an existing non-shortcut controller for this app, open it. | 758 // If there is an existing non-shortcut controller for this app, open it. |
| 763 ash::ShelfID id = GetShelfIDForAppID(app_id); | 759 ash::ShelfID id = GetShelfIDForAppID(app_id); |
| 764 if (id) { | 760 if (id) { |
| 765 LauncherItemController* controller = GetLauncherItemController(id); | 761 LauncherItemController* controller = GetLauncherItemController(id); |
| (...skipping 1364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2130 void ChromeLauncherController::ReleaseProfile() { | 2126 void ChromeLauncherController::ReleaseProfile() { |
| 2131 if (app_sync_ui_state_) | 2127 if (app_sync_ui_state_) |
| 2132 app_sync_ui_state_->RemoveObserver(this); | 2128 app_sync_ui_state_->RemoveObserver(this); |
| 2133 | 2129 |
| 2134 extensions::ExtensionRegistry::Get(profile_)->RemoveObserver(this); | 2130 extensions::ExtensionRegistry::Get(profile_)->RemoveObserver(this); |
| 2135 | 2131 |
| 2136 PrefServiceSyncable::FromProfile(profile_)->RemoveObserver(this); | 2132 PrefServiceSyncable::FromProfile(profile_)->RemoveObserver(this); |
| 2137 | 2133 |
| 2138 pref_change_registrar_.RemoveAll(); | 2134 pref_change_registrar_.RemoveAll(); |
| 2139 } | 2135 } |
| OLD | NEW |