| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "athena/extensions/public/extensions_delegate.h" | 5 #include "athena/extensions/public/extensions_delegate.h" |
| 6 | 6 |
| 7 #include "athena/extensions/chrome/athena_apps_client.h" | 7 #include "athena/extensions/chrome/athena_apps_client.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
| 10 #include "chrome/browser/extensions/extension_util.h" | 10 #include "chrome/browser/extensions/extension_util.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/browser/ui/extensions/application_launch.h" | 12 #include "chrome/browser/ui/extensions/application_launch.h" |
| 13 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" | 13 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" |
| 14 #include "extensions/browser/extension_registry.h" | 14 #include "extensions/browser/extension_registry.h" |
| 15 #include "extensions/browser/extension_system.h" | 15 #include "extensions/browser/extension_system.h" |
| 16 #include "extensions/common/constants.h" |
| 16 #include "extensions/common/extension_set.h" | 17 #include "extensions/common/extension_set.h" |
| 17 #include "extensions/common/extension_urls.h" | 18 #include "extensions/common/extension_urls.h" |
| 18 #include "net/base/url_util.h" | 19 #include "net/base/url_util.h" |
| 19 | 20 |
| 20 namespace athena { | 21 namespace athena { |
| 21 namespace { | 22 namespace { |
| 22 | 23 |
| 23 class ChromeExtensionsDelegate : public ExtensionsDelegate { | 24 class ChromeExtensionsDelegate : public ExtensionsDelegate { |
| 24 public: | 25 public: |
| 25 explicit ChromeExtensionsDelegate(content::BrowserContext* context) | 26 explicit ChromeExtensionsDelegate(content::BrowserContext* context) |
| (...skipping 26 matching lines...) Expand all Loading... |
| 52 if (!extensions::util::IsAppLaunchableWithoutEnabling(app_id, context)) | 53 if (!extensions::util::IsAppLaunchableWithoutEnabling(app_id, context)) |
| 53 return false; | 54 return false; |
| 54 | 55 |
| 55 int event_flags = 0; | 56 int event_flags = 0; |
| 56 AppLaunchParams params(Profile::FromBrowserContext(context), | 57 AppLaunchParams params(Profile::FromBrowserContext(context), |
| 57 extension, | 58 extension, |
| 58 event_flags, | 59 event_flags, |
| 59 chrome::HOST_DESKTOP_TYPE_ASH); | 60 chrome::HOST_DESKTOP_TYPE_ASH); |
| 60 // TODO(oshima): rename HOST_DESTOP_TYPE_ASH to non native desktop. | 61 // TODO(oshima): rename HOST_DESTOP_TYPE_ASH to non native desktop. |
| 61 | 62 |
| 62 if (app_id == extension_misc::kWebStoreAppId) { | 63 if (app_id == extensions::kWebStoreAppId) { |
| 63 std::string source_value = | 64 std::string source_value = |
| 64 std::string(extension_urls::kLaunchSourceAppList); | 65 std::string(extension_urls::kLaunchSourceAppList); |
| 65 // Set an override URL to include the source. | 66 // Set an override URL to include the source. |
| 66 GURL extension_url = | 67 GURL extension_url = |
| 67 extensions::AppLaunchInfo::GetFullLaunchURL(extension); | 68 extensions::AppLaunchInfo::GetFullLaunchURL(extension); |
| 68 params.override_url = net::AppendQueryParameter( | 69 params.override_url = net::AppendQueryParameter( |
| 69 extension_url, extension_urls::kWebstoreSourceField, source_value); | 70 extension_url, extension_urls::kWebstoreSourceField, source_value); |
| 70 } | 71 } |
| 71 params.container = extensions::LAUNCH_CONTAINER_WINDOW; | 72 params.container = extensions::LAUNCH_CONTAINER_WINDOW; |
| 72 | 73 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 91 | 92 |
| 92 } // namespace | 93 } // namespace |
| 93 | 94 |
| 94 // static | 95 // static |
| 95 void ExtensionsDelegate::CreateExtensionsDelegateForChrome( | 96 void ExtensionsDelegate::CreateExtensionsDelegateForChrome( |
| 96 content::BrowserContext* context) { | 97 content::BrowserContext* context) { |
| 97 new ChromeExtensionsDelegate(context); | 98 new ChromeExtensionsDelegate(context); |
| 98 } | 99 } |
| 99 | 100 |
| 100 } // namespace athena | 101 } // namespace athena |
| OLD | NEW |