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

Side by Side Diff: chrome/renderer/extensions/dispatcher.cc

Issue 22794012: Rename extension_manifest_keys namespace to extensions::manifest_keys. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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/renderer/extensions/dispatcher.h" 5 #include "chrome/renderer/extensions/dispatcher.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/alias.h" 9 #include "base/debug/alias.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/sha1.h" 12 #include "base/sha1.h"
13 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
14 #include "base/strings/string_piece.h" 14 #include "base/strings/string_piece.h"
15 #include "base/strings/string_split.h" 15 #include "base/strings/string_split.h"
16 #include "base/strings/string_util.h" 16 #include "base/strings/string_util.h"
17 #include "chrome/common/child_process_logging.h" 17 #include "chrome/common/child_process_logging.h"
18 #include "chrome/common/chrome_switches.h" 18 #include "chrome/common/chrome_switches.h"
19 #include "chrome/common/chrome_version_info.h" 19 #include "chrome/common/chrome_version_info.h"
20 #include "chrome/common/extensions/api/extension_api.h" 20 #include "chrome/common/extensions/api/extension_api.h"
21 #include "chrome/common/extensions/background_info.h" 21 #include "chrome/common/extensions/background_info.h"
22 #include "chrome/common/extensions/extension.h" 22 #include "chrome/common/extensions/extension.h"
23 #include "chrome/common/extensions/extension_constants.h" 23 #include "chrome/common/extensions/extension_constants.h"
24 #include "chrome/common/extensions/extension_manifest_constants.h"
25 #include "chrome/common/extensions/extension_messages.h" 24 #include "chrome/common/extensions/extension_messages.h"
26 #include "chrome/common/extensions/features/feature.h" 25 #include "chrome/common/extensions/features/feature.h"
27 #include "chrome/common/extensions/features/feature_channel.h" 26 #include "chrome/common/extensions/features/feature_channel.h"
28 #include "chrome/common/extensions/manifest.h" 27 #include "chrome/common/extensions/manifest.h"
29 #include "chrome/common/extensions/manifest_handlers/externally_connectable.h" 28 #include "chrome/common/extensions/manifest_handlers/externally_connectable.h"
30 #include "chrome/common/extensions/manifest_handlers/sandboxed_page_info.h" 29 #include "chrome/common/extensions/manifest_handlers/sandboxed_page_info.h"
31 #include "chrome/common/extensions/message_bundle.h" 30 #include "chrome/common/extensions/message_bundle.h"
32 #include "chrome/common/extensions/permissions/permission_set.h" 31 #include "chrome/common/extensions/permissions/permission_set.h"
33 #include "chrome/common/extensions/permissions/permissions_data.h" 32 #include "chrome/common/extensions/permissions/permissions_data.h"
34 #include "chrome/common/url_constants.h" 33 #include "chrome/common/url_constants.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 #include "chrome/renderer/extensions/tts_custom_bindings.h" 71 #include "chrome/renderer/extensions/tts_custom_bindings.h"
73 #include "chrome/renderer/extensions/user_script_slave.h" 72 #include "chrome/renderer/extensions/user_script_slave.h"
74 #include "chrome/renderer/extensions/web_request_custom_bindings.h" 73 #include "chrome/renderer/extensions/web_request_custom_bindings.h"
75 #include "chrome/renderer/extensions/webstore_bindings.h" 74 #include "chrome/renderer/extensions/webstore_bindings.h"
76 #include "chrome/renderer/resource_bundle_source_map.h" 75 #include "chrome/renderer/resource_bundle_source_map.h"
77 #include "content/public/renderer/render_thread.h" 76 #include "content/public/renderer/render_thread.h"
78 #include "content/public/renderer/render_view.h" 77 #include "content/public/renderer/render_view.h"
79 #include "content/public/renderer/v8_value_converter.h" 78 #include "content/public/renderer/v8_value_converter.h"
80 #include "extensions/common/constants.h" 79 #include "extensions/common/constants.h"
81 #include "extensions/common/features/feature_provider.h" 80 #include "extensions/common/features/feature_provider.h"
81 #include "extensions/common/manifest_constants.h"
82 #include "extensions/common/view_type.h" 82 #include "extensions/common/view_type.h"
83 #include "grit/common_resources.h" 83 #include "grit/common_resources.h"
84 #include "grit/renderer_resources.h" 84 #include "grit/renderer_resources.h"
85 #include "third_party/WebKit/public/platform/WebString.h" 85 #include "third_party/WebKit/public/platform/WebString.h"
86 #include "third_party/WebKit/public/platform/WebURLRequest.h" 86 #include "third_party/WebKit/public/platform/WebURLRequest.h"
87 #include "third_party/WebKit/public/web/WebCustomElement.h" 87 #include "third_party/WebKit/public/web/WebCustomElement.h"
88 #include "third_party/WebKit/public/web/WebDataSource.h" 88 #include "third_party/WebKit/public/web/WebDataSource.h"
89 #include "third_party/WebKit/public/web/WebDocument.h" 89 #include "third_party/WebKit/public/web/WebDocument.h"
90 #include "third_party/WebKit/public/web/WebFrame.h" 90 #include "third_party/WebKit/public/web/WebFrame.h"
91 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" 91 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h"
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 function_names_.insert(names[i]); 506 function_names_.insert(names[i]);
507 } 507 }
508 508
509 void Dispatcher::OnSetSystemFont(const std::string& font_family, 509 void Dispatcher::OnSetSystemFont(const std::string& font_family,
510 const std::string& font_size) { 510 const std::string& font_size) {
511 system_font_family_ = font_family; 511 system_font_family_ = font_family;
512 system_font_size_ = font_size; 512 system_font_size_ = font_size;
513 } 513 }
514 514
515 void Dispatcher::OnSetChannel(int channel) { 515 void Dispatcher::OnSetChannel(int channel) {
516 extensions::SetCurrentChannel( 516 SetCurrentChannel(static_cast<chrome::VersionInfo::Channel>(channel));
517 static_cast<chrome::VersionInfo::Channel>(channel));
518 } 517 }
519 518
520 void Dispatcher::OnMessageInvoke(const std::string& extension_id, 519 void Dispatcher::OnMessageInvoke(const std::string& extension_id,
521 const std::string& module_name, 520 const std::string& module_name,
522 const std::string& function_name, 521 const std::string& function_name,
523 const base::ListValue& args, 522 const base::ListValue& args,
524 bool user_gesture) { 523 bool user_gesture) {
525 InvokeModuleSystemMethod( 524 InvokeModuleSystemMethod(
526 NULL, extension_id, module_name, function_name, args, user_gesture); 525 NULL, extension_id, module_name, function_name, args, user_gesture);
527 } 526 }
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 RegisterBinding("app", context); 656 RegisterBinding("app", context);
658 RegisterBinding("webstore", context); 657 RegisterBinding("webstore", context);
659 658
660 // ... and that the runtime API might be available if any extension can 659 // ... and that the runtime API might be available if any extension can
661 // connect to it. 660 // connect to it.
662 bool runtime_is_available = false; 661 bool runtime_is_available = false;
663 for (ExtensionSet::const_iterator it = extensions_.begin(); 662 for (ExtensionSet::const_iterator it = extensions_.begin();
664 it != extensions_.end(); ++it) { 663 it != extensions_.end(); ++it) {
665 ExternallyConnectableInfo* info = 664 ExternallyConnectableInfo* info =
666 static_cast<ExternallyConnectableInfo*>((*it)->GetManifestData( 665 static_cast<ExternallyConnectableInfo*>((*it)->GetManifestData(
667 extension_manifest_keys::kExternallyConnectable)); 666 manifest_keys::kExternallyConnectable));
668 if (info && info->matches.MatchesURL(context->GetURL())) { 667 if (info && info->matches.MatchesURL(context->GetURL())) {
669 runtime_is_available = true; 668 runtime_is_available = true;
670 break; 669 break;
671 } 670 }
672 } 671 }
673 if (runtime_is_available) 672 if (runtime_is_available)
674 RegisterBinding("runtime", context); 673 RegisterBinding("runtime", context);
675 break; 674 break;
676 } 675 }
677 676
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after
1423 } 1422 }
1424 1423
1425 void Dispatcher::OnCancelSuspend(const std::string& extension_id) { 1424 void Dispatcher::OnCancelSuspend(const std::string& extension_id) {
1426 DispatchEvent(extension_id, kOnSuspendCanceledEvent); 1425 DispatchEvent(extension_id, kOnSuspendCanceledEvent);
1427 } 1426 }
1428 1427
1429 // TODO(kalman): This is checking for the wrong thing, it should be checking if 1428 // TODO(kalman): This is checking for the wrong thing, it should be checking if
1430 // the frame's security origin is unique. The extension sandbox directive is 1429 // the frame's security origin is unique. The extension sandbox directive is
1431 // checked for in chrome/common/extensions/csp_handler.cc. 1430 // checked for in chrome/common/extensions/csp_handler.cc.
1432 bool Dispatcher::IsSandboxedPage(const GURL& url) const { 1431 bool Dispatcher::IsSandboxedPage(const GURL& url) const {
1433 if (url.SchemeIs(extensions::kExtensionScheme)) { 1432 if (url.SchemeIs(kExtensionScheme)) {
1434 const Extension* extension = extensions_.GetByID(url.host()); 1433 const Extension* extension = extensions_.GetByID(url.host());
1435 if (extension) { 1434 if (extension) {
1436 return extensions::SandboxedPageInfo::IsSandboxedPage(extension, 1435 return SandboxedPageInfo::IsSandboxedPage(extension, url.path());
1437 url.path());
1438 } 1436 }
1439 } 1437 }
1440 return false; 1438 return false;
1441 } 1439 }
1442 1440
1443 Feature::Context Dispatcher::ClassifyJavaScriptContext( 1441 Feature::Context Dispatcher::ClassifyJavaScriptContext(
1444 const std::string& extension_id, 1442 const std::string& extension_id,
1445 int extension_group, 1443 int extension_group,
1446 const GURL& url, 1444 const GURL& url,
1447 const WebKit::WebSecurityOrigin& origin) { 1445 const WebKit::WebSecurityOrigin& origin) {
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1568 RenderView* background_view = 1566 RenderView* background_view =
1569 ExtensionHelper::GetBackgroundPage(extension_id); 1567 ExtensionHelper::GetBackgroundPage(extension_id);
1570 if (background_view) { 1568 if (background_view) {
1571 background_view->Send(new ExtensionHostMsg_EventAck( 1569 background_view->Send(new ExtensionHostMsg_EventAck(
1572 background_view->GetRoutingID())); 1570 background_view->GetRoutingID()));
1573 } 1571 }
1574 } 1572 }
1575 } 1573 }
1576 1574
1577 } // namespace extensions 1575 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698