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

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

Issue 246423002: Split feature definitions into extensions and chrome features. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: appserver, etc. Created 6 years, 8 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"
11 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
12 #include "base/metrics/user_metrics_action.h" 11 #include "base/metrics/user_metrics_action.h"
13 #include "base/sha1.h" 12 #include "base/sha1.h"
14 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
15 #include "base/strings/string_piece.h" 14 #include "base/strings/string_piece.h"
16 #include "base/strings/string_split.h" 15 #include "base/strings/string_split.h"
17 #include "base/strings/string_util.h" 16 #include "base/strings/string_util.h"
17 #include "base/values.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/crash_keys.h" 20 #include "chrome/common/crash_keys.h"
21 #include "chrome/common/extensions/features/feature_channel.h" 21 #include "chrome/common/extensions/features/feature_channel.h"
22 #include "chrome/common/extensions/manifest_handlers/externally_connectable.h" 22 #include "chrome/common/extensions/manifest_handlers/externally_connectable.h"
23 #include "chrome/common/url_constants.h" 23 #include "chrome/common/url_constants.h"
24 #include "chrome/renderer/chrome_render_process_observer.h" 24 #include "chrome/renderer/chrome_render_process_observer.h"
25 #include "chrome/renderer/extensions/api_activity_logger.h" 25 #include "chrome/renderer/extensions/api_activity_logger.h"
26 #include "chrome/renderer/extensions/app_bindings.h" 26 #include "chrome/renderer/extensions/app_bindings.h"
27 #include "chrome/renderer/extensions/app_runtime_custom_bindings.h" 27 #include "chrome/renderer/extensions/app_runtime_custom_bindings.h"
(...skipping 18 matching lines...) Expand all
46 #include "content/public/renderer/render_view.h" 46 #include "content/public/renderer/render_view.h"
47 #include "content/public/renderer/v8_value_converter.h" 47 #include "content/public/renderer/v8_value_converter.h"
48 #include "extensions/common/api/messaging/message.h" 48 #include "extensions/common/api/messaging/message.h"
49 #include "extensions/common/constants.h" 49 #include "extensions/common/constants.h"
50 #include "extensions/common/extension.h" 50 #include "extensions/common/extension.h"
51 #include "extensions/common/extension_api.h" 51 #include "extensions/common/extension_api.h"
52 #include "extensions/common/extension_messages.h" 52 #include "extensions/common/extension_messages.h"
53 #include "extensions/common/extension_urls.h" 53 #include "extensions/common/extension_urls.h"
54 #include "extensions/common/features/feature.h" 54 #include "extensions/common/features/feature.h"
55 #include "extensions/common/features/feature_provider.h" 55 #include "extensions/common/features/feature_provider.h"
56 #include "extensions/common/features/json_feature_provider_source.h"
56 #include "extensions/common/manifest.h" 57 #include "extensions/common/manifest.h"
57 #include "extensions/common/manifest_constants.h" 58 #include "extensions/common/manifest_constants.h"
58 #include "extensions/common/manifest_handlers/background_info.h" 59 #include "extensions/common/manifest_handlers/background_info.h"
59 #include "extensions/common/manifest_handlers/sandboxed_page_info.h" 60 #include "extensions/common/manifest_handlers/sandboxed_page_info.h"
60 #include "extensions/common/message_bundle.h" 61 #include "extensions/common/message_bundle.h"
61 #include "extensions/common/permissions/permission_set.h" 62 #include "extensions/common/permissions/permission_set.h"
62 #include "extensions/common/permissions/permissions_data.h" 63 #include "extensions/common/permissions/permissions_data.h"
63 #include "extensions/common/switches.h" 64 #include "extensions/common/switches.h"
64 #include "extensions/common/view_type.h" 65 #include "extensions/common/view_type.h"
65 #include "extensions/renderer/api_definitions_natives.h" 66 #include "extensions/renderer/api_definitions_natives.h"
(...skipping 13 matching lines...) Expand all
79 #include "extensions/renderer/object_backed_native_handler.h" 80 #include "extensions/renderer/object_backed_native_handler.h"
80 #include "extensions/renderer/render_view_observer_natives.h" 81 #include "extensions/renderer/render_view_observer_natives.h"
81 #include "extensions/renderer/request_sender.h" 82 #include "extensions/renderer/request_sender.h"
82 #include "extensions/renderer/safe_builtins.h" 83 #include "extensions/renderer/safe_builtins.h"
83 #include "extensions/renderer/script_context.h" 84 #include "extensions/renderer/script_context.h"
84 #include "extensions/renderer/script_context_set.h" 85 #include "extensions/renderer/script_context_set.h"
85 #include "extensions/renderer/send_request_natives.h" 86 #include "extensions/renderer/send_request_natives.h"
86 #include "extensions/renderer/set_icon_natives.h" 87 #include "extensions/renderer/set_icon_natives.h"
87 #include "extensions/renderer/utils_native_handler.h" 88 #include "extensions/renderer/utils_native_handler.h"
88 #include "grit/common_resources.h" 89 #include "grit/common_resources.h"
90 #include "grit/extensions_resources.h"
89 #include "grit/renderer_resources.h" 91 #include "grit/renderer_resources.h"
90 #include "third_party/WebKit/public/platform/WebString.h" 92 #include "third_party/WebKit/public/platform/WebString.h"
91 #include "third_party/WebKit/public/platform/WebURLRequest.h" 93 #include "third_party/WebKit/public/platform/WebURLRequest.h"
92 #include "third_party/WebKit/public/web/WebCustomElement.h" 94 #include "third_party/WebKit/public/web/WebCustomElement.h"
93 #include "third_party/WebKit/public/web/WebDataSource.h" 95 #include "third_party/WebKit/public/web/WebDataSource.h"
94 #include "third_party/WebKit/public/web/WebDocument.h" 96 #include "third_party/WebKit/public/web/WebDocument.h"
95 #include "third_party/WebKit/public/web/WebFrame.h" 97 #include "third_party/WebKit/public/web/WebFrame.h"
96 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" 98 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h"
97 #include "third_party/WebKit/public/web/WebScopedUserGesture.h" 99 #include "third_party/WebKit/public/web/WebScopedUserGesture.h"
98 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" 100 #include "third_party/WebKit/public/web/WebSecurityPolicy.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 public: 156 public:
155 explicit TestFeaturesNativeHandler(ScriptContext* context) 157 explicit TestFeaturesNativeHandler(ScriptContext* context)
156 : ObjectBackedNativeHandler(context) { 158 : ObjectBackedNativeHandler(context) {
157 RouteFunction("GetAPIFeatures", 159 RouteFunction("GetAPIFeatures",
158 base::Bind(&TestFeaturesNativeHandler::GetAPIFeatures, 160 base::Bind(&TestFeaturesNativeHandler::GetAPIFeatures,
159 base::Unretained(this))); 161 base::Unretained(this)));
160 } 162 }
161 163
162 private: 164 private:
163 void GetAPIFeatures(const v8::FunctionCallbackInfo<v8::Value>& args) { 165 void GetAPIFeatures(const v8::FunctionCallbackInfo<v8::Value>& args) {
164 base::Value* value = base::JSONReader::Read( 166 JSONFeatureProviderSource source("api");
165 ResourceBundle::GetSharedInstance().GetRawDataResource( 167 source.LoadJSON(IDR_CHROME_EXTENSION_API_FEATURES);
166 IDR_EXTENSION_API_FEATURES).as_string()); 168 source.LoadJSON(IDR_EXTENSION_API_FEATURES);
167 scoped_ptr<content::V8ValueConverter> converter( 169 scoped_ptr<content::V8ValueConverter> converter(
168 content::V8ValueConverter::create()); 170 content::V8ValueConverter::create());
169 args.GetReturnValue().Set( 171 args.GetReturnValue().Set(
170 converter->ToV8Value(value, context()->v8_context())); 172 converter->ToV8Value(&source.dictionary(), context()->v8_context()));
171 } 173 }
172 }; 174 };
173 175
174 class UserGesturesNativeHandler : public ObjectBackedNativeHandler { 176 class UserGesturesNativeHandler : public ObjectBackedNativeHandler {
175 public: 177 public:
176 explicit UserGesturesNativeHandler(ScriptContext* context) 178 explicit UserGesturesNativeHandler(ScriptContext* context)
177 : ObjectBackedNativeHandler(context) { 179 : ObjectBackedNativeHandler(context) {
178 RouteFunction("IsProcessingUserGesture", 180 RouteFunction("IsProcessingUserGesture",
179 base::Bind(&UserGesturesNativeHandler::IsProcessingUserGesture, 181 base::Bind(&UserGesturesNativeHandler::IsProcessingUserGesture,
180 base::Unretained(this))); 182 base::Unretained(this)));
(...skipping 1522 matching lines...) Expand 10 before | Expand all | Expand 10 after
1703 } 1705 }
1704 1706
1705 void Dispatcher::ClearPortData(int port_id) { 1707 void Dispatcher::ClearPortData(int port_id) {
1706 // Only the target port side has entries in |port_to_tab_id_map_|. If 1708 // Only the target port side has entries in |port_to_tab_id_map_|. If
1707 // |port_id| is a source port, std::map::erase() will just silently fail 1709 // |port_id| is a source port, std::map::erase() will just silently fail
1708 // here as a no-op. 1710 // here as a no-op.
1709 port_to_tab_id_map_.erase(port_id); 1711 port_to_tab_id_map_.erase(port_id);
1710 } 1712 }
1711 1713
1712 } // namespace extensions 1714 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698