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

Side by Side Diff: extensions/browser/api/guest_view/web_view/web_view_internal_api.cc

Issue 1226353004: Generate all extension schema namespaces as "api" and instead vary the generated bundle names. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 5 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 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 "extensions/browser/api/guest_view/web_view/web_view_internal_api.h" 5 #include "extensions/browser/api/guest_view/web_view/web_view_internal_api.h"
6 6
7 #include "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "content/public/browser/browser_context.h" 10 #include "content/public/browser/browser_context.h"
11 #include "content/public/browser/render_frame_host.h" 11 #include "content/public/browser/render_frame_host.h"
12 #include "content/public/browser/render_process_host.h" 12 #include "content/public/browser/render_process_host.h"
13 #include "content/public/browser/render_view_host.h" 13 #include "content/public/browser/render_view_host.h"
14 #include "content/public/browser/web_contents.h" 14 #include "content/public/browser/web_contents.h"
15 #include "content/public/common/stop_find_action.h" 15 #include "content/public/common/stop_find_action.h"
16 #include "content/public/common/url_fetcher.h" 16 #include "content/public/common/url_fetcher.h"
17 #include "extensions/browser/guest_view/web_view/web_view_constants.h" 17 #include "extensions/browser/guest_view/web_view/web_view_constants.h"
18 #include "extensions/browser/guest_view/web_view/web_view_content_script_manager .h" 18 #include "extensions/browser/guest_view/web_view/web_view_content_script_manager .h"
19 #include "extensions/common/api/web_view_internal.h" 19 #include "extensions/common/api/web_view_internal.h"
20 #include "extensions/common/error_utils.h" 20 #include "extensions/common/error_utils.h"
21 #include "extensions/common/manifest_constants.h" 21 #include "extensions/common/manifest_constants.h"
22 #include "extensions/common/permissions/permissions_data.h" 22 #include "extensions/common/permissions/permissions_data.h"
23 #include "extensions/common/user_script.h" 23 #include "extensions/common/user_script.h"
24 #include "third_party/WebKit/public/web/WebFindOptions.h" 24 #include "third_party/WebKit/public/web/WebFindOptions.h"
25 25
26 using content::WebContents; 26 using content::WebContents;
27 using extensions::ExtensionResource; 27 using extensions::ExtensionResource;
28 using extensions::core_api::web_view_internal::ContentScriptDetails; 28 using extensions::api::web_view_internal::ContentScriptDetails;
29 using extensions::core_api::web_view_internal::InjectionItems; 29 using extensions::api::web_view_internal::InjectionItems;
30 using extensions::core_api::web_view_internal::SetPermission::Params; 30 using extensions::api::web_view_internal::SetPermission::Params;
31 using extensions::core_api::extension_types::InjectDetails; 31 using extensions::api::extension_types::InjectDetails;
32 using extensions::UserScript; 32 using extensions::UserScript;
33 using ui_zoom::ZoomController; 33 using ui_zoom::ZoomController;
34 // error messages for content scripts: 34 // error messages for content scripts:
35 namespace errors = extensions::manifest_errors; 35 namespace errors = extensions::manifest_errors;
36 namespace web_view_internal = extensions::core_api::web_view_internal; 36 namespace web_view_internal = extensions::api::web_view_internal;
37 37
38 namespace { 38 namespace {
39 39
40 const char kAppCacheKey[] = "appcache"; 40 const char kAppCacheKey[] = "appcache";
41 const char kCacheKey[] = "cache"; 41 const char kCacheKey[] = "cache";
42 const char kCookiesKey[] = "cookies"; 42 const char kCookiesKey[] = "cookies";
43 const char kFileSystemsKey[] = "fileSystems"; 43 const char kFileSystemsKey[] = "fileSystems";
44 const char kIndexedDBKey[] = "indexedDB"; 44 const char kIndexedDBKey[] = "indexedDB";
45 const char kLocalStorageKey[] = "localStorage"; 45 const char kLocalStorageKey[] = "localStorage";
46 const char kWebSQLKey[] = "webSQL"; 46 const char kWebSQLKey[] = "webSQL";
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 *error = errors::kInvalidExcludeMatches; 149 *error = errors::kInvalidExcludeMatches;
150 return false; 150 return false;
151 } 151 }
152 script->add_exclude_url_pattern(pattern); 152 script->add_exclude_url_pattern(pattern);
153 } 153 }
154 } 154 }
155 // run_at: 155 // run_at:
156 if (script_value.run_at) { 156 if (script_value.run_at) {
157 UserScript::RunLocation run_at = UserScript::UNDEFINED; 157 UserScript::RunLocation run_at = UserScript::UNDEFINED;
158 switch (script_value.run_at) { 158 switch (script_value.run_at) {
159 case extensions::core_api::extension_types::RUN_AT_NONE: 159 case extensions::api::extension_types::RUN_AT_NONE:
160 case extensions::core_api::extension_types::RUN_AT_DOCUMENT_IDLE: 160 case extensions::api::extension_types::RUN_AT_DOCUMENT_IDLE:
161 run_at = UserScript::DOCUMENT_IDLE; 161 run_at = UserScript::DOCUMENT_IDLE;
162 break; 162 break;
163 case extensions::core_api::extension_types::RUN_AT_DOCUMENT_START: 163 case extensions::api::extension_types::RUN_AT_DOCUMENT_START:
164 run_at = UserScript::DOCUMENT_START; 164 run_at = UserScript::DOCUMENT_START;
165 break; 165 break;
166 case extensions::core_api::extension_types::RUN_AT_DOCUMENT_END: 166 case extensions::api::extension_types::RUN_AT_DOCUMENT_END:
167 run_at = UserScript::DOCUMENT_END; 167 run_at = UserScript::DOCUMENT_END;
168 break; 168 break;
169 } 169 }
170 // The default for run_at is RUN_AT_DOCUMENT_IDLE. 170 // The default for run_at is RUN_AT_DOCUMENT_IDLE.
171 script->set_run_location(run_at); 171 script->set_run_location(run_at);
172 } 172 }
173 173
174 // match_about_blank: 174 // match_about_blank:
175 if (script_value.match_about_blank) 175 if (script_value.match_about_blank)
176 script->set_match_about_blank(*script_value.match_about_blank); 176 script->set_match_about_blank(*script_value.match_about_blank);
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 } 737 }
738 738
739 bool WebViewInternalSetPermissionFunction::RunAsyncSafe(WebViewGuest* guest) { 739 bool WebViewInternalSetPermissionFunction::RunAsyncSafe(WebViewGuest* guest) {
740 scoped_ptr<web_view_internal::SetPermission::Params> params( 740 scoped_ptr<web_view_internal::SetPermission::Params> params(
741 web_view_internal::SetPermission::Params::Create(*args_)); 741 web_view_internal::SetPermission::Params::Create(*args_));
742 EXTENSION_FUNCTION_VALIDATE(params.get()); 742 EXTENSION_FUNCTION_VALIDATE(params.get());
743 743
744 WebViewPermissionHelper::PermissionResponseAction action = 744 WebViewPermissionHelper::PermissionResponseAction action =
745 WebViewPermissionHelper::DEFAULT; 745 WebViewPermissionHelper::DEFAULT;
746 switch (params->action) { 746 switch (params->action) {
747 case core_api::web_view_internal::SET_PERMISSION_ACTION_ALLOW: 747 case api::web_view_internal::SET_PERMISSION_ACTION_ALLOW:
748 action = WebViewPermissionHelper::ALLOW; 748 action = WebViewPermissionHelper::ALLOW;
749 break; 749 break;
750 case core_api::web_view_internal::SET_PERMISSION_ACTION_DENY: 750 case api::web_view_internal::SET_PERMISSION_ACTION_DENY:
751 action = WebViewPermissionHelper::DENY; 751 action = WebViewPermissionHelper::DENY;
752 break; 752 break;
753 case core_api::web_view_internal::SET_PERMISSION_ACTION_DEFAULT: 753 case api::web_view_internal::SET_PERMISSION_ACTION_DEFAULT:
754 break; 754 break;
755 default: 755 default:
756 NOTREACHED(); 756 NOTREACHED();
757 } 757 }
758 758
759 std::string user_input; 759 std::string user_input;
760 if (params->user_input) 760 if (params->user_input)
761 user_input = *params->user_input; 761 user_input = *params->user_input;
762 762
763 WebViewPermissionHelper* web_view_permission_helper = 763 WebViewPermissionHelper* web_view_permission_helper =
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 // Will finish asynchronously. 892 // Will finish asynchronously.
893 return true; 893 return true;
894 } 894 }
895 895
896 void WebViewInternalClearDataFunction::ClearDataDone() { 896 void WebViewInternalClearDataFunction::ClearDataDone() {
897 Release(); // Balanced in RunAsync(). 897 Release(); // Balanced in RunAsync().
898 SendResponse(true); 898 SendResponse(true);
899 } 899 }
900 900
901 } // namespace extensions 901 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/api/guest_view/guest_view_internal_api.cc ('k') | extensions/browser/api/hid/hid_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698