| 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 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 732 app_id == extensions::kWebStoreAppId) { | 732 app_id == extensions::kWebStoreAppId) { |
| 733 // Get the corresponding source string. | 733 // Get the corresponding source string. |
| 734 std::string source_value = GetSourceFromAppListSource(source); | 734 std::string source_value = GetSourceFromAppListSource(source); |
| 735 | 735 |
| 736 // Set an override URL to include the source. | 736 // Set an override URL to include the source. |
| 737 GURL extension_url = extensions::AppLaunchInfo::GetFullLaunchURL(extension); | 737 GURL extension_url = extensions::AppLaunchInfo::GetFullLaunchURL(extension); |
| 738 params.override_url = net::AppendQueryParameter( | 738 params.override_url = net::AppendQueryParameter( |
| 739 extension_url, extension_urls::kWebstoreSourceField, source_value); | 739 extension_url, extension_urls::kWebstoreSourceField, source_value); |
| 740 } | 740 } |
| 741 | 741 |
| 742 params.source = (source == ash::LAUNCH_FROM_UNKNOWN) |
| 743 ? extensions::SOURCE_UNKNOWN |
| 744 : extensions::SOURCE_APP_LAUNCHER; |
| 745 |
| 742 OpenApplication(params); | 746 OpenApplication(params); |
| 743 } | 747 } |
| 744 | 748 |
| 745 void ChromeLauncherController::ActivateApp(const std::string& app_id, | 749 void ChromeLauncherController::ActivateApp(const std::string& app_id, |
| 746 ash::LaunchSource source, | 750 ash::LaunchSource source, |
| 747 int event_flags) { | 751 int event_flags) { |
| 748 // If there is an existing non-shortcut controller for this app, open it. | 752 // If there is an existing non-shortcut controller for this app, open it. |
| 749 ash::ShelfID id = GetShelfIDForAppID(app_id); | 753 ash::ShelfID id = GetShelfIDForAppID(app_id); |
| 750 if (id) { | 754 if (id) { |
| 751 LauncherItemController* controller = id_to_item_controller_map_[id]; | 755 LauncherItemController* controller = id_to_item_controller_map_[id]; |
| (...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1749 keyboard::SetKeyboardShowOverride( | 1753 keyboard::SetKeyboardShowOverride( |
| 1750 enable ? keyboard::KEYBOARD_SHOW_OVERRIDE_ENABLED | 1754 enable ? keyboard::KEYBOARD_SHOW_OVERRIDE_ENABLED |
| 1751 : keyboard::KEYBOARD_SHOW_OVERRIDE_DISABLED); | 1755 : keyboard::KEYBOARD_SHOW_OVERRIDE_DISABLED); |
| 1752 } | 1756 } |
| 1753 const bool is_enabled = keyboard::IsKeyboardEnabled(); | 1757 const bool is_enabled = keyboard::IsKeyboardEnabled(); |
| 1754 if (was_enabled && !is_enabled) | 1758 if (was_enabled && !is_enabled) |
| 1755 ash::Shell::GetInstance()->DeactivateKeyboard(); | 1759 ash::Shell::GetInstance()->DeactivateKeyboard(); |
| 1756 else if (is_enabled && !was_enabled) | 1760 else if (is_enabled && !was_enabled) |
| 1757 ash::Shell::GetInstance()->CreateKeyboard(); | 1761 ash::Shell::GetInstance()->CreateKeyboard(); |
| 1758 } | 1762 } |
| 1759 #endif // defined(OS_CHROMEOS) | 1763 #endif // defined(OS_CHROMEOS) |
| 1760 | 1764 |
| 1761 ash::ShelfItemStatus ChromeLauncherController::GetAppState( | 1765 ash::ShelfItemStatus ChromeLauncherController::GetAppState( |
| 1762 const std::string& app_id) { | 1766 const std::string& app_id) { |
| 1763 ash::ShelfItemStatus status = ash::STATUS_CLOSED; | 1767 ash::ShelfItemStatus status = ash::STATUS_CLOSED; |
| 1764 for (WebContentsToAppIDMap::iterator it = web_contents_to_app_id_.begin(); | 1768 for (WebContentsToAppIDMap::iterator it = web_contents_to_app_id_.begin(); |
| 1765 it != web_contents_to_app_id_.end(); | 1769 it != web_contents_to_app_id_.end(); |
| 1766 ++it) { | 1770 ++it) { |
| 1767 if (it->second == app_id) { | 1771 if (it->second == app_id) { |
| 1768 Browser* browser = chrome::FindBrowserWithWebContents(it->first); | 1772 Browser* browser = chrome::FindBrowserWithWebContents(it->first); |
| 1769 // Usually there should never be an item in our |web_contents_to_app_id_| | 1773 // Usually there should never be an item in our |web_contents_to_app_id_| |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2092 void ChromeLauncherController::ReleaseProfile() { | 2096 void ChromeLauncherController::ReleaseProfile() { |
| 2093 if (app_sync_ui_state_) | 2097 if (app_sync_ui_state_) |
| 2094 app_sync_ui_state_->RemoveObserver(this); | 2098 app_sync_ui_state_->RemoveObserver(this); |
| 2095 | 2099 |
| 2096 extensions::ExtensionRegistry::Get(profile_)->RemoveObserver(this); | 2100 extensions::ExtensionRegistry::Get(profile_)->RemoveObserver(this); |
| 2097 | 2101 |
| 2098 PrefServiceSyncable::FromProfile(profile_)->RemoveObserver(this); | 2102 PrefServiceSyncable::FromProfile(profile_)->RemoveObserver(this); |
| 2099 | 2103 |
| 2100 pref_change_registrar_.RemoveAll(); | 2104 pref_change_registrar_.RemoveAll(); |
| 2101 } | 2105 } |
| OLD | NEW |