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

Unified Diff: extensions/browser/api/guest_view/web_view/web_view_internal_api.cc

Issue 1021073002: <webview> Implement clear http cache API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync after http://crrev.com/1033013003 Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: extensions/browser/api/guest_view/web_view/web_view_internal_api.cc
diff --git a/extensions/browser/api/guest_view/web_view/web_view_internal_api.cc b/extensions/browser/api/guest_view/web_view/web_view_internal_api.cc
index c55733559faf6d05473f668707230c2e577cd733..43cd90bfd34e5043b6d0d808caab03710f78c760 100644
--- a/extensions/browser/api/guest_view/web_view/web_view_internal_api.cc
+++ b/extensions/browser/api/guest_view/web_view/web_view_internal_api.cc
@@ -8,20 +8,21 @@
#include "base/strings/utf_string_conversions.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
-#include "content/public/browser/storage_partition.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/stop_find_action.h"
+#include "extensions/browser/guest_view/web_view/web_view_constants.h"
#include "extensions/common/api/web_view_internal.h"
#include "third_party/WebKit/public/web/WebFindOptions.h"
using content::WebContents;
using extensions::core_api::web_view_internal::SetPermission::Params;
using extensions::core_api::extension_types::InjectDetails;
-namespace webview = extensions::core_api::web_view_internal;
+namespace web_view_internal = extensions::core_api::web_view_internal;
namespace {
const char kAppCacheKey[] = "appcache";
+const char kCacheKey[] = "cache";
const char kCookiesKey[] = "cookies";
const char kFileSystemsKey[] = "fileSystems";
const char kIndexedDBKey[] = "indexedDB";
@@ -29,19 +30,21 @@ const char kLocalStorageKey[] = "localStorage";
const char kWebSQLKey[] = "webSQL";
const char kSinceKey[] = "since";
-int MaskForKey(const char* key) {
+uint32 MaskForKey(const char* key) {
if (strcmp(key, kAppCacheKey) == 0)
- return content::StoragePartition::REMOVE_DATA_MASK_APPCACHE;
+ return webview::WEB_VIEW_REMOVE_DATA_MASK_APPCACHE;
+ if (strcmp(key, kCacheKey) == 0)
+ return webview::WEB_VIEW_REMOVE_DATA_MASK_CACHE;
if (strcmp(key, kCookiesKey) == 0)
- return content::StoragePartition::REMOVE_DATA_MASK_COOKIES;
+ return webview::WEB_VIEW_REMOVE_DATA_MASK_COOKIES;
if (strcmp(key, kFileSystemsKey) == 0)
- return content::StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS;
+ return webview::WEB_VIEW_REMOVE_DATA_MASK_FILE_SYSTEMS;
if (strcmp(key, kIndexedDBKey) == 0)
- return content::StoragePartition::REMOVE_DATA_MASK_INDEXEDDB;
+ return webview::WEB_VIEW_REMOVE_DATA_MASK_INDEXEDDB;
if (strcmp(key, kLocalStorageKey) == 0)
- return content::StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE;
+ return webview::WEB_VIEW_REMOVE_DATA_MASK_LOCAL_STORAGE;
if (strcmp(key, kWebSQLKey) == 0)
- return content::StoragePartition::REMOVE_DATA_MASK_WEBSQL;
+ return webview::WEB_VIEW_REMOVE_DATA_MASK_WEBSQL;
return 0;
}
@@ -61,8 +64,8 @@ bool WebViewInternalExtensionFunction::RunAsync() {
}
bool WebViewInternalNavigateFunction::RunAsyncSafe(WebViewGuest* guest) {
- scoped_ptr<webview::Navigate::Params> params(
- webview::Navigate::Params::Create(*args_));
+ scoped_ptr<web_view_internal::Navigate::Params> params(
+ web_view_internal::Navigate::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
std::string src = params->src;
guest->NavigateGuest(src, true /* force_navigation */);
@@ -172,8 +175,8 @@ WebViewInternalSetNameFunction::~WebViewInternalSetNameFunction() {
}
bool WebViewInternalSetNameFunction::RunAsyncSafe(WebViewGuest* guest) {
- scoped_ptr<webview::SetName::Params> params(
- webview::SetName::Params::Create(*args_));
+ scoped_ptr<web_view_internal::SetName::Params> params(
+ web_view_internal::SetName::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
guest->SetName(params->frame_name);
SendResponse(true);
@@ -190,8 +193,8 @@ WebViewInternalSetAllowTransparencyFunction::
bool WebViewInternalSetAllowTransparencyFunction::RunAsyncSafe(
WebViewGuest* guest) {
- scoped_ptr<webview::SetAllowTransparency::Params> params(
- webview::SetAllowTransparency::Params::Create(*args_));
+ scoped_ptr<web_view_internal::SetAllowTransparency::Params> params(
+ web_view_internal::SetAllowTransparency::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
guest->SetAllowTransparency(params->allow);
SendResponse(true);
@@ -207,8 +210,8 @@ WebViewInternalSetAllowScalingFunction::
}
bool WebViewInternalSetAllowScalingFunction::RunAsyncSafe(WebViewGuest* guest) {
- scoped_ptr<webview::SetAllowScaling::Params> params(
- webview::SetAllowScaling::Params::Create(*args_));
+ scoped_ptr<web_view_internal::SetAllowScaling::Params> params(
+ web_view_internal::SetAllowScaling::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
guest->SetAllowScaling(params->allow);
SendResponse(true);
@@ -222,8 +225,8 @@ WebViewInternalSetZoomFunction::~WebViewInternalSetZoomFunction() {
}
bool WebViewInternalSetZoomFunction::RunAsyncSafe(WebViewGuest* guest) {
- scoped_ptr<webview::SetZoom::Params> params(
- webview::SetZoom::Params::Create(*args_));
+ scoped_ptr<web_view_internal::SetZoom::Params> params(
+ web_view_internal::SetZoom::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
guest->SetZoom(params->zoom_factor);
@@ -238,8 +241,8 @@ WebViewInternalGetZoomFunction::~WebViewInternalGetZoomFunction() {
}
bool WebViewInternalGetZoomFunction::RunAsyncSafe(WebViewGuest* guest) {
- scoped_ptr<webview::GetZoom::Params> params(
- webview::GetZoom::Params::Create(*args_));
+ scoped_ptr<web_view_internal::GetZoom::Params> params(
+ web_view_internal::GetZoom::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
double zoom_factor = guest->zoom();
@@ -255,8 +258,8 @@ WebViewInternalFindFunction::~WebViewInternalFindFunction() {
}
bool WebViewInternalFindFunction::RunAsyncSafe(WebViewGuest* guest) {
- scoped_ptr<webview::Find::Params> params(
- webview::Find::Params::Create(*args_));
+ scoped_ptr<web_view_internal::Find::Params> params(
+ web_view_internal::Find::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
// Convert the std::string search_text to string16.
@@ -284,20 +287,20 @@ WebViewInternalStopFindingFunction::~WebViewInternalStopFindingFunction() {
}
bool WebViewInternalStopFindingFunction::RunAsyncSafe(WebViewGuest* guest) {
- scoped_ptr<webview::StopFinding::Params> params(
- webview::StopFinding::Params::Create(*args_));
+ scoped_ptr<web_view_internal::StopFinding::Params> params(
+ web_view_internal::StopFinding::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
// Set the StopFindAction.
content::StopFindAction action;
switch (params->action) {
- case webview::StopFinding::Params::ACTION_CLEAR:
+ case web_view_internal::StopFinding::Params::ACTION_CLEAR:
action = content::STOP_FIND_ACTION_CLEAR_SELECTION;
break;
- case webview::StopFinding::Params::ACTION_KEEP:
+ case web_view_internal::StopFinding::Params::ACTION_KEEP:
action = content::STOP_FIND_ACTION_KEEP_SELECTION;
break;
- case webview::StopFinding::Params::ACTION_ACTIVATE:
+ case web_view_internal::StopFinding::Params::ACTION_ACTIVATE:
action = content::STOP_FIND_ACTION_ACTIVATE_SELECTION;
break;
default:
@@ -318,8 +321,8 @@ WebViewInternalLoadDataWithBaseUrlFunction::
bool WebViewInternalLoadDataWithBaseUrlFunction::RunAsyncSafe(
WebViewGuest* guest) {
- scoped_ptr<webview::LoadDataWithBaseUrl::Params> params(
- webview::LoadDataWithBaseUrl::Params::Create(*args_));
+ scoped_ptr<web_view_internal::LoadDataWithBaseUrl::Params> params(
+ web_view_internal::LoadDataWithBaseUrl::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
// If a virtual URL was provided, use it. Otherwise, the user will be shown
@@ -340,7 +343,8 @@ WebViewInternalGoFunction::~WebViewInternalGoFunction() {
}
bool WebViewInternalGoFunction::RunAsyncSafe(WebViewGuest* guest) {
- scoped_ptr<webview::Go::Params> params(webview::Go::Params::Create(*args_));
+ scoped_ptr<web_view_internal::Go::Params> params(
+ web_view_internal::Go::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
bool successful = guest->Go(params->relative_index);
@@ -367,8 +371,8 @@ WebViewInternalSetPermissionFunction::~WebViewInternalSetPermissionFunction() {
}
bool WebViewInternalSetPermissionFunction::RunAsyncSafe(WebViewGuest* guest) {
- scoped_ptr<webview::SetPermission::Params> params(
- webview::SetPermission::Params::Create(*args_));
+ scoped_ptr<web_view_internal::SetPermission::Params> params(
+ web_view_internal::SetPermission::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
WebViewPermissionHelper::PermissionResponseAction action =
@@ -416,8 +420,8 @@ WebViewInternalOverrideUserAgentFunction::
bool WebViewInternalOverrideUserAgentFunction::RunAsyncSafe(
WebViewGuest* guest) {
- scoped_ptr<webview::OverrideUserAgent::Params> params(
- webview::OverrideUserAgent::Params::Create(*args_));
+ scoped_ptr<web_view_internal::OverrideUserAgent::Params> params(
+ web_view_internal::OverrideUserAgent::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
guest->SetUserAgentOverride(params->user_agent_override);

Powered by Google App Engine
This is Rietveld 408576698