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

Side by Side Diff: chrome/browser/extensions/platform_app_launcher.cc

Issue 11741014: Move 'intents' parsing out of Extension (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed special_storage_policy unittest Created 7 years, 11 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 (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/extensions/platform_app_launcher.h" 5 #include "chrome/browser/extensions/platform_app_launcher.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/string_util.h" 12 #include "base/string_util.h"
13 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
14 #include "chrome/browser/extensions/api/app_runtime/app_runtime_api.h" 14 #include "chrome/browser/extensions/api/app_runtime/app_runtime_api.h"
15 #include "chrome/browser/extensions/app_file_handler_util.h" 15 #include "chrome/browser/extensions/app_file_handler_util.h"
16 #include "chrome/browser/extensions/extension_host.h" 16 #include "chrome/browser/extensions/extension_host.h"
17 #include "chrome/browser/extensions/extension_process_manager.h" 17 #include "chrome/browser/extensions/extension_process_manager.h"
18 #include "chrome/browser/extensions/extension_system.h" 18 #include "chrome/browser/extensions/extension_system.h"
19 #include "chrome/browser/extensions/lazy_background_task_queue.h" 19 #include "chrome/browser/extensions/lazy_background_task_queue.h"
20 #include "chrome/browser/intents/web_intents_util.h" 20 #include "chrome/browser/intents/web_intents_util.h"
21 #include "chrome/browser/profiles/profile.h" 21 #include "chrome/browser/profiles/profile.h"
22 #include "chrome/common/extensions/extension.h" 22 #include "chrome/common/extensions/extension.h"
23 #include "chrome/common/extensions/extension_messages.h" 23 #include "chrome/common/extensions/extension_messages.h"
24 #include "chrome/common/extensions/web_intents_handler.h"
24 #include "content/public/browser/browser_thread.h" 25 #include "content/public/browser/browser_thread.h"
25 #include "content/public/browser/child_process_security_policy.h" 26 #include "content/public/browser/child_process_security_policy.h"
26 #include "content/public/browser/render_process_host.h" 27 #include "content/public/browser/render_process_host.h"
27 #include "content/public/browser/web_contents.h" 28 #include "content/public/browser/web_contents.h"
28 #include "content/public/browser/web_intents_dispatcher.h" 29 #include "content/public/browser/web_intents_dispatcher.h"
29 #include "net/base/mime_util.h" 30 #include "net/base/mime_util.h"
30 #include "net/base/net_util.h" 31 #include "net/base/net_util.h"
31 #include "webkit/fileapi/file_system_types.h" 32 #include "webkit/fileapi/file_system_types.h"
32 #include "webkit/fileapi/isolated_context.h" 33 #include "webkit/fileapi/isolated_context.h"
33 #include "webkit/glue/web_intent_data.h" 34 #include "webkit/glue/web_intent_data.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 << file_path_.value(); 168 << file_path_.value();
168 LaunchWithNoLaunchData(); 169 LaunchWithNoLaunchData();
169 return; 170 return;
170 } 171 }
171 found_service = !!handler; 172 found_service = !!handler;
172 173
173 // TODO(benwells): remove this once we no longer support the "intents" 174 // TODO(benwells): remove this once we no longer support the "intents"
174 // syntax in platform app manifests. 175 // syntax in platform app manifests.
175 if (!found_service) { 176 if (!found_service) {
176 std::vector<webkit_glue::WebIntentServiceData> services = 177 std::vector<webkit_glue::WebIntentServiceData> services =
177 extension_->intents_services(); 178 extensions::WebIntentsInfo::GetIntentsServices(extension_);
178 for (size_t i = 0; i < services.size(); i++) { 179 for (size_t i = 0; i < services.size(); i++) {
179 std::string service_type_ascii = UTF16ToASCII(services[i].type); 180 std::string service_type_ascii = UTF16ToASCII(services[i].type);
180 if (services[i].action == ASCIIToUTF16(web_intents::kActionView) && 181 if (services[i].action == ASCIIToUTF16(web_intents::kActionView) &&
181 net::MatchesMimeType(service_type_ascii, mime_type)) { 182 net::MatchesMimeType(service_type_ascii, mime_type)) {
182 found_service = true; 183 found_service = true;
183 break; 184 break;
184 } 185 }
185 } 186 }
186 } 187 }
187 188
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 const Extension* extension, 411 const Extension* extension,
411 content::WebIntentsDispatcher* intents_dispatcher, 412 content::WebIntentsDispatcher* intents_dispatcher,
412 content::WebContents* source) { 413 content::WebContents* source) {
413 scoped_refptr<PlatformAppWebIntentLauncher> launcher = 414 scoped_refptr<PlatformAppWebIntentLauncher> launcher =
414 new PlatformAppWebIntentLauncher( 415 new PlatformAppWebIntentLauncher(
415 profile, extension, intents_dispatcher, source); 416 profile, extension, intents_dispatcher, source);
416 launcher->Launch(); 417 launcher->Launch();
417 } 418 }
418 419
419 } // namespace extensions 420 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_special_storage_policy_unittest.cc ('k') | chrome/browser/extensions/web_intents_parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698