Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: athena/extensions/chrome/extensions_delegate_impl.cc

Issue 544813002: Support V1 app (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/activity/public/activity_factory.h"
8 #include "athena/activity/public/activity_manager.h"
7 #include "athena/extensions/chrome/athena_apps_client.h" 9 #include "athena/extensions/chrome/athena_apps_client.h"
8 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/extensions/extension_service.h" 12 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/extensions/extension_util.h" 13 #include "chrome/browser/extensions/extension_util.h"
11 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/ui/extensions/application_launch.h" 15 #include "chrome/browser/ui/extensions/application_launch.h"
13 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" 16 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h"
14 #include "extensions/browser/extension_registry.h" 17 #include "extensions/browser/extension_registry.h"
15 #include "extensions/browser/extension_system.h" 18 #include "extensions/browser/extension_system.h"
16 #include "extensions/common/constants.h" 19 #include "extensions/common/constants.h"
17 #include "extensions/common/extension_set.h" 20 #include "extensions/common/extension_set.h"
18 #include "extensions/common/extension_urls.h" 21 #include "extensions/common/extension_urls.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 std::string source_value = 67 std::string source_value =
65 std::string(extension_urls::kLaunchSourceAppList); 68 std::string(extension_urls::kLaunchSourceAppList);
66 // Set an override URL to include the source. 69 // Set an override URL to include the source.
67 GURL extension_url = 70 GURL extension_url =
68 extensions::AppLaunchInfo::GetFullLaunchURL(extension); 71 extensions::AppLaunchInfo::GetFullLaunchURL(extension);
69 params.override_url = net::AppendQueryParameter( 72 params.override_url = net::AppendQueryParameter(
70 extension_url, extension_urls::kWebstoreSourceField, source_value); 73 extension_url, extension_urls::kWebstoreSourceField, source_value);
71 } 74 }
72 params.container = extensions::LAUNCH_CONTAINER_WINDOW; 75 params.container = extensions::LAUNCH_CONTAINER_WINDOW;
73 76
74 OpenApplication(params); 77 // V2 apps
78 if (CanLaunchViaEvent(extension)) {
79 OpenApplication(params);
80 return true;
81 }
82 LaunchV1App(params, extension);
75 return true; 83 return true;
76 } 84 }
85
77 virtual bool UnloadApp(const std::string& app_id) OVERRIDE { 86 virtual bool UnloadApp(const std::string& app_id) OVERRIDE {
78 // TODO(skuhne): Implement using extension service. 87 // TODO(skuhne): Implement using extension service.
79 return false; 88 return false;
80 } 89 }
81 90
91 void LaunchV1App(const AppLaunchParams& params,
92 const extensions::Extension* extension) {
93 // TODO(oshima): Just activate if the app is already running.
94 const GURL url_input = params.override_url;
95
96 DCHECK(!url_input.is_empty() || extension);
97 GURL url = UrlForExtension(extension, url_input);
98 athena::ActivityManager::Get()->AddActivity(
99 athena::ActivityFactory::Get()->CreateWebActivity(
100 GetBrowserContext(), base::UTF8ToUTF16(extension->name()), url));
101 }
102
82 // ExtensionService for the browser context this is created for. 103 // ExtensionService for the browser context this is created for.
83 ExtensionService* extension_service_; 104 ExtensionService* extension_service_;
84 105
85 // Installed extensions. 106 // Installed extensions.
86 extensions::ExtensionSet extensions_; 107 extensions::ExtensionSet extensions_;
87 108
88 AthenaAppsClient apps_client_; 109 AthenaAppsClient apps_client_;
89 110
90 DISALLOW_COPY_AND_ASSIGN(ChromeExtensionsDelegate); 111 DISALLOW_COPY_AND_ASSIGN(ChromeExtensionsDelegate);
91 }; 112 };
92 113
93 } // namespace 114 } // namespace
94 115
95 // static 116 // static
96 void ExtensionsDelegate::CreateExtensionsDelegateForChrome( 117 void ExtensionsDelegate::CreateExtensionsDelegateForChrome(
97 content::BrowserContext* context) { 118 content::BrowserContext* context) {
98 new ChromeExtensionsDelegate(context); 119 new ChromeExtensionsDelegate(context);
99 } 120 }
100 121
101 } // namespace athena 122 } // namespace athena
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698