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

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

Issue 635233008: Make management.launchApp() work for hosted apps on Athena (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@webstore_dialogs_athena
Patch Set: Created 6 years, 2 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
« no previous file with comments | « no previous file | chrome/browser/ui/BUILD.gn » ('j') | chrome/browser/ui/athena/extensions/DEPS » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/extensions/chrome/athena_chrome_app_window_client.h" 7 #include "athena/extensions/chrome/athena_chrome_app_window_client.h"
9 #include "base/macros.h" 8 #include "base/macros.h"
10 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
11 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
12 #include "chrome/browser/extensions/extension_util.h" 11 #include "chrome/browser/extensions/extension_util.h"
13 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/ui/extensions/application_launch.h" 13 #include "chrome/browser/ui/extensions/application_launch.h"
15 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" 14 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h"
16 #include "extensions/browser/extension_registry.h" 15 #include "extensions/browser/extension_registry.h"
17 #include "extensions/browser/extension_system.h" 16 #include "extensions/browser/extension_system.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 std::string source_value = 67 std::string source_value =
69 std::string(extension_urls::kLaunchSourceAppList); 68 std::string(extension_urls::kLaunchSourceAppList);
70 // Set an override URL to include the source. 69 // Set an override URL to include the source.
71 GURL extension_url = 70 GURL extension_url =
72 extensions::AppLaunchInfo::GetFullLaunchURL(extension); 71 extensions::AppLaunchInfo::GetFullLaunchURL(extension);
73 params.override_url = net::AppendQueryParameter( 72 params.override_url = net::AppendQueryParameter(
74 extension_url, extension_urls::kWebstoreSourceField, source_value); 73 extension_url, extension_urls::kWebstoreSourceField, source_value);
75 } 74 }
76 params.container = extensions::LAUNCH_CONTAINER_WINDOW; 75 params.container = extensions::LAUNCH_CONTAINER_WINDOW;
77 76
78 // V2 apps 77 OpenApplication(params);
79 if (CanLaunchViaEvent(extension)) {
80 OpenApplication(params);
81 return true;
82 }
83 LaunchV1App(params, extension);
84 return true; 78 return true;
85 } 79 }
86 80
87 virtual bool UnloadApp(const std::string& app_id) override { 81 virtual bool UnloadApp(const std::string& app_id) override {
88 // TODO(skuhne): Implement using extension service. 82 // TODO(skuhne): Implement using extension service.
89 return false; 83 return false;
90 } 84 }
91 85
92 void LaunchV1App(const AppLaunchParams& params,
93 const extensions::Extension* extension) {
94 // TODO(oshima): Just activate if the app is already running.
95 const GURL url_input = params.override_url;
96
97 DCHECK(!url_input.is_empty() || extension);
98 GURL url = UrlForExtension(extension, url_input);
99 athena::ActivityFactory::Get()->CreateWebActivity(
100 GetBrowserContext(), base::UTF8ToUTF16(extension->name()), url);
101 }
102
103 // ExtensionService for the browser context this is created for. 86 // ExtensionService for the browser context this is created for.
104 ExtensionService* extension_service_; 87 ExtensionService* extension_service_;
105 88
106 // Installed extensions. 89 // Installed extensions.
107 extensions::ExtensionSet extensions_; 90 extensions::ExtensionSet extensions_;
108 91
109 AthenaChromeAppWindowClient app_window_client_; 92 AthenaChromeAppWindowClient app_window_client_;
110 93
111 DISALLOW_COPY_AND_ASSIGN(ChromeExtensionsDelegate); 94 DISALLOW_COPY_AND_ASSIGN(ChromeExtensionsDelegate);
112 }; 95 };
113 96
114 } // namespace 97 } // namespace
115 98
116 // static 99 // static
117 void ExtensionsDelegate::CreateExtensionsDelegate( 100 void ExtensionsDelegate::CreateExtensionsDelegate(
118 content::BrowserContext* context) { 101 content::BrowserContext* context) {
119 new ChromeExtensionsDelegate(context); 102 new ChromeExtensionsDelegate(context);
120 } 103 }
121 104
122 } // namespace athena 105 } // namespace athena
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/BUILD.gn » ('j') | chrome/browser/ui/athena/extensions/DEPS » ('J')

Powered by Google App Engine
This is Rietveld 408576698