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

Side by Side Diff: chrome/common/extensions/web_intents_handler.cc

Issue 12253022: Manifest handler for all keys background-related. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
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/common/extensions/web_intents_handler.h" 5 #include "chrome/common/extensions/web_intents_handler.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "chrome/common/extensions/background_info.h"
12 #include "chrome/common/extensions/extension_manifest_constants.h" 13 #include "chrome/common/extensions/extension_manifest_constants.h"
13 #include "chrome/common/extensions/manifest.h" 14 #include "chrome/common/extensions/manifest.h"
14 #include "extensions/common/error_utils.h" 15 #include "extensions/common/error_utils.h"
15 #include "webkit/glue/web_intent_service_data.h" 16 #include "webkit/glue/web_intent_service_data.h"
16 17
17 namespace extensions { 18 namespace extensions {
18 19
19 namespace keys = extension_manifest_keys; 20 namespace keys = extension_manifest_keys;
20 namespace values = extension_manifest_values; 21 namespace values = extension_manifest_values;
21 namespace errors = extension_manifest_errors; 22 namespace errors = extension_manifest_errors;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 if (extension->is_hosted_app()) { 90 if (extension->is_hosted_app()) {
90 // Hosted apps require an absolute URL for intents. 91 // Hosted apps require an absolute URL for intents.
91 if (!service_url.is_valid() || 92 if (!service_url.is_valid() ||
92 !(extension->web_extent().MatchesURL(service_url))) { 93 !(extension->web_extent().MatchesURL(service_url))) {
93 *error = ErrorUtils::FormatErrorMessageUTF16( 94 *error = ErrorUtils::FormatErrorMessageUTF16(
94 errors::kInvalidIntentPageInHostedApp, action_name); 95 errors::kInvalidIntentPageInHostedApp, action_name);
95 return false; 96 return false;
96 } 97 }
97 service.service_url = service_url; 98 service.service_url = service_url;
98 } else if (extension->is_platform_app()) { 99 } else if (extension->is_platform_app()) {
99 service.service_url = extension->GetBackgroundURL(); 100 service.service_url = BackgroundInfo::GetBackgroundURL(extension);
100 } else { 101 } else {
101 // We do not allow absolute intent URLs in non-hosted apps. 102 // We do not allow absolute intent URLs in non-hosted apps.
102 if (service_url.is_valid()) { 103 if (service_url.is_valid()) {
103 *error = ErrorUtils::FormatErrorMessageUTF16( 104 *error = ErrorUtils::FormatErrorMessageUTF16(
104 errors::kCannotAccessPage, href); 105 errors::kCannotAccessPage, href);
105 return false; 106 return false;
106 } 107 }
107 service.service_url = extension->GetResourceURL(href); 108 service.service_url = extension->GetResourceURL(href);
108 } 109 }
109 110
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 } 202 }
202 if (!LoadWebIntentsAction(*iter, *one_service, extension, 203 if (!LoadWebIntentsAction(*iter, *one_service, extension,
203 error, &info->intents_services_)) 204 error, &info->intents_services_))
204 return false; 205 return false;
205 } 206 }
206 } 207 }
207 extension->SetManifestData(keys::kIntents, info.release()); 208 extension->SetManifestData(keys::kIntents, info.release());
208 return true; 209 return true;
209 } 210 }
210 211
212 const std::vector<std::string>& WebIntentsHandler::PrerequisiteKeys() const {
Yoyo Zhou 2013/02/15 02:28:25 I went to all this effort and then found out WebIn
213 std::vector<std::string> prereq_keys;
214 prereq_keys.push_back(keys::kBackgroundPage);
215 prereq_keys.push_back(keys::kBackgroundPageLegacy);
216 prereq_keys.push_back(keys::kBackgroundScripts);
217 prereq_keys.push_back(keys::kPlatformAppBackgroundPage);
218 prereq_keys.push_back(keys::kPlatformAppBackgroundScripts);
219 return prereq_keys;
220 }
221
211 } // namespace extensions 222 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698