| 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/ash/launcher/launcher_controller_helper.h" | 5 #include "chrome/browser/ui/ash/launcher/launcher_controller_helper.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 arc_session_manager->IsArcManaged()) | 162 arc_session_manager->IsArcManaged()) |
| 163 return false; | 163 return false; |
| 164 } | 164 } |
| 165 | 165 |
| 166 return true; | 166 return true; |
| 167 } | 167 } |
| 168 | 168 |
| 169 void LauncherControllerHelper::LaunchApp(const std::string& app_id, | 169 void LauncherControllerHelper::LaunchApp(const std::string& app_id, |
| 170 ash::LaunchSource source, | 170 ash::LaunchSource source, |
| 171 int event_flags) { | 171 int event_flags) { |
| 172 LaunchAppWithLaunchId(app_id, "", source, event_flags); |
| 173 } |
| 174 |
| 175 void LauncherControllerHelper::LaunchAppWithLaunchId( |
| 176 const std::string& app_id, |
| 177 const std::string& launch_id, |
| 178 ash::LaunchSource source, |
| 179 int event_flags) { |
| 172 const ArcAppListPrefs* arc_prefs = GetArcAppListPrefs(); | 180 const ArcAppListPrefs* arc_prefs = GetArcAppListPrefs(); |
| 173 if (arc_prefs && arc_prefs->IsRegistered(app_id)) { | 181 if (arc_prefs && arc_prefs->IsRegistered(app_id)) { |
| 174 arc::LaunchApp(profile_, app_id, event_flags); | 182 arc::LaunchApp(profile_, app_id, event_flags); |
| 175 return; | 183 return; |
| 176 } | 184 } |
| 177 | 185 |
| 178 // |extension| could be null when it is being unloaded for updating. | 186 // |extension| could be null when it is being unloaded for updating. |
| 179 const extensions::Extension* extension = GetExtensionByID(profile_, app_id); | 187 const extensions::Extension* extension = GetExtensionByID(profile_, app_id); |
| 180 if (!extension) | 188 if (!extension) |
| 181 return; | 189 return; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 197 if (source != ash::LAUNCH_FROM_UNKNOWN && | 205 if (source != ash::LAUNCH_FROM_UNKNOWN && |
| 198 app_id == extensions::kWebStoreAppId) { | 206 app_id == extensions::kWebStoreAppId) { |
| 199 // Get the corresponding source string. | 207 // Get the corresponding source string. |
| 200 std::string source_value = GetSourceFromAppListSource(source); | 208 std::string source_value = GetSourceFromAppListSource(source); |
| 201 | 209 |
| 202 // Set an override URL to include the source. | 210 // Set an override URL to include the source. |
| 203 GURL extension_url = extensions::AppLaunchInfo::GetFullLaunchURL(extension); | 211 GURL extension_url = extensions::AppLaunchInfo::GetFullLaunchURL(extension); |
| 204 params.override_url = net::AppendQueryParameter( | 212 params.override_url = net::AppendQueryParameter( |
| 205 extension_url, extension_urls::kWebstoreSourceField, source_value); | 213 extension_url, extension_urls::kWebstoreSourceField, source_value); |
| 206 } | 214 } |
| 215 params.launch_id = launch_id; |
| 207 | 216 |
| 208 OpenApplication(params); | 217 OpenApplication(params); |
| 209 } | 218 } |
| 210 | 219 |
| 211 ArcAppListPrefs* LauncherControllerHelper::GetArcAppListPrefs() const { | 220 ArcAppListPrefs* LauncherControllerHelper::GetArcAppListPrefs() const { |
| 212 return ArcAppListPrefs::Get(profile_); | 221 return ArcAppListPrefs::Get(profile_); |
| 213 } | 222 } |
| 214 | 223 |
| 215 void LauncherControllerHelper::ExtensionEnableFlowFinished() { | 224 void LauncherControllerHelper::ExtensionEnableFlowFinished() { |
| 216 LaunchApp(extension_enable_flow_->extension_id(), ash::LAUNCH_FROM_UNKNOWN, | 225 LaunchApp(extension_enable_flow_->extension_id(), ash::LAUNCH_FROM_UNKNOWN, |
| 217 ui::EF_NONE); | 226 ui::EF_NONE); |
| 218 extension_enable_flow_.reset(); | 227 extension_enable_flow_.reset(); |
| 219 } | 228 } |
| 220 | 229 |
| 221 void LauncherControllerHelper::ExtensionEnableFlowAborted(bool user_initiated) { | 230 void LauncherControllerHelper::ExtensionEnableFlowAborted(bool user_initiated) { |
| 222 extension_enable_flow_.reset(); | 231 extension_enable_flow_.reset(); |
| 223 } | 232 } |
| OLD | NEW |