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

Side by Side 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: fix compile error on mac/android: std::set initializer list makes them unhappy 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 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/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "content/public/browser/browser_context.h" 9 #include "content/public/browser/browser_context.h"
10 #include "content/public/browser/render_process_host.h" 10 #include "content/public/browser/render_process_host.h"
11 #include "content/public/browser/render_view_host.h" 11 #include "content/public/browser/render_view_host.h"
12 #include "content/public/browser/storage_partition.h"
13 #include "content/public/browser/web_contents.h" 12 #include "content/public/browser/web_contents.h"
14 #include "content/public/common/stop_find_action.h" 13 #include "content/public/common/stop_find_action.h"
15 #include "content/public/common/url_fetcher.h" 14 #include "content/public/common/url_fetcher.h"
15 #include "extensions/browser/guest_view/web_view/web_view_constants.h"
16 #include "extensions/common/api/web_view_internal.h" 16 #include "extensions/common/api/web_view_internal.h"
17 #include "extensions/common/error_utils.h" 17 #include "extensions/common/error_utils.h"
18 #include "net/base/load_flags.h" 18 #include "net/base/load_flags.h"
19 #include "net/url_request/url_fetcher.h" 19 #include "net/url_request/url_fetcher.h"
20 #include "net/url_request/url_fetcher_delegate.h" 20 #include "net/url_request/url_fetcher_delegate.h"
21 #include "third_party/WebKit/public/web/WebFindOptions.h" 21 #include "third_party/WebKit/public/web/WebFindOptions.h"
22 22
23 using content::WebContents; 23 using content::WebContents;
24 using extensions::core_api::web_view_internal::SetPermission::Params; 24 using extensions::core_api::web_view_internal::SetPermission::Params;
25 using extensions::core_api::extension_types::InjectDetails; 25 using extensions::core_api::extension_types::InjectDetails;
26 namespace webview = extensions::core_api::web_view_internal; 26 namespace web_view_internal = extensions::core_api::web_view_internal;
27 27
28 namespace { 28 namespace {
29 29
30 const char kAppCacheKey[] = "appcache"; 30 const char kAppCacheKey[] = "appcache";
31 const char kCacheKey[] = "cache";
31 const char kCookiesKey[] = "cookies"; 32 const char kCookiesKey[] = "cookies";
32 const char kFileSystemsKey[] = "fileSystems"; 33 const char kFileSystemsKey[] = "fileSystems";
33 const char kIndexedDBKey[] = "indexedDB"; 34 const char kIndexedDBKey[] = "indexedDB";
34 const char kLocalStorageKey[] = "localStorage"; 35 const char kLocalStorageKey[] = "localStorage";
35 const char kWebSQLKey[] = "webSQL"; 36 const char kWebSQLKey[] = "webSQL";
36 const char kSinceKey[] = "since"; 37 const char kSinceKey[] = "since";
37 const char kLoadFileError[] = "Failed to load file: \"*\". "; 38 const char kLoadFileError[] = "Failed to load file: \"*\". ";
38 39
39 int MaskForKey(const char* key) { 40 uint32 MaskForKey(const char* key) {
40 if (strcmp(key, kAppCacheKey) == 0) 41 if (strcmp(key, kAppCacheKey) == 0)
41 return content::StoragePartition::REMOVE_DATA_MASK_APPCACHE; 42 return webview::WEB_VIEW_REMOVE_DATA_MASK_APPCACHE;
43 if (strcmp(key, kCacheKey) == 0)
44 return webview::WEB_VIEW_REMOVE_DATA_MASK_CACHE;
42 if (strcmp(key, kCookiesKey) == 0) 45 if (strcmp(key, kCookiesKey) == 0)
43 return content::StoragePartition::REMOVE_DATA_MASK_COOKIES; 46 return webview::WEB_VIEW_REMOVE_DATA_MASK_COOKIES;
44 if (strcmp(key, kFileSystemsKey) == 0) 47 if (strcmp(key, kFileSystemsKey) == 0)
45 return content::StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS; 48 return webview::WEB_VIEW_REMOVE_DATA_MASK_FILE_SYSTEMS;
46 if (strcmp(key, kIndexedDBKey) == 0) 49 if (strcmp(key, kIndexedDBKey) == 0)
47 return content::StoragePartition::REMOVE_DATA_MASK_INDEXEDDB; 50 return webview::WEB_VIEW_REMOVE_DATA_MASK_INDEXEDDB;
48 if (strcmp(key, kLocalStorageKey) == 0) 51 if (strcmp(key, kLocalStorageKey) == 0)
49 return content::StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE; 52 return webview::WEB_VIEW_REMOVE_DATA_MASK_LOCAL_STORAGE;
50 if (strcmp(key, kWebSQLKey) == 0) 53 if (strcmp(key, kWebSQLKey) == 0)
51 return content::StoragePartition::REMOVE_DATA_MASK_WEBSQL; 54 return webview::WEB_VIEW_REMOVE_DATA_MASK_WEBSQL;
52 return 0; 55 return 0;
53 } 56 }
54 57
55 } // namespace 58 } // namespace
56 59
57 namespace extensions { 60 namespace extensions {
58 61
59 // WebUIURLFetcher downloads the content of a file by giving its |url| on WebUI. 62 // WebUIURLFetcher downloads the content of a file by giving its |url| on WebUI.
60 // Each WebUIURLFetcher is associated with a given |render_process_id, 63 // Each WebUIURLFetcher is associated with a given |render_process_id,
61 // render_view_id| pair. 64 // render_view_id| pair.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &instance_id)); 109 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &instance_id));
107 WebViewGuest* guest = WebViewGuest::From( 110 WebViewGuest* guest = WebViewGuest::From(
108 render_view_host()->GetProcess()->GetID(), instance_id); 111 render_view_host()->GetProcess()->GetID(), instance_id);
109 if (!guest) 112 if (!guest)
110 return false; 113 return false;
111 114
112 return RunAsyncSafe(guest); 115 return RunAsyncSafe(guest);
113 } 116 }
114 117
115 bool WebViewInternalNavigateFunction::RunAsyncSafe(WebViewGuest* guest) { 118 bool WebViewInternalNavigateFunction::RunAsyncSafe(WebViewGuest* guest) {
116 scoped_ptr<webview::Navigate::Params> params( 119 scoped_ptr<web_view_internal::Navigate::Params> params(
117 webview::Navigate::Params::Create(*args_)); 120 web_view_internal::Navigate::Params::Create(*args_));
118 EXTENSION_FUNCTION_VALIDATE(params.get()); 121 EXTENSION_FUNCTION_VALIDATE(params.get());
119 std::string src = params->src; 122 std::string src = params->src;
120 guest->NavigateGuest(src, true /* force_navigation */); 123 guest->NavigateGuest(src, true /* force_navigation */);
121 return true; 124 return true;
122 } 125 }
123 126
124 WebViewInternalExecuteCodeFunction::WebViewInternalExecuteCodeFunction() 127 WebViewInternalExecuteCodeFunction::WebViewInternalExecuteCodeFunction()
125 : guest_instance_id_(0), guest_src_(GURL::EmptyGURL()) { 128 : guest_instance_id_(0), guest_src_(GURL::EmptyGURL()) {
126 } 129 }
127 130
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 return true; 255 return true;
253 } 256 }
254 257
255 WebViewInternalSetNameFunction::WebViewInternalSetNameFunction() { 258 WebViewInternalSetNameFunction::WebViewInternalSetNameFunction() {
256 } 259 }
257 260
258 WebViewInternalSetNameFunction::~WebViewInternalSetNameFunction() { 261 WebViewInternalSetNameFunction::~WebViewInternalSetNameFunction() {
259 } 262 }
260 263
261 bool WebViewInternalSetNameFunction::RunAsyncSafe(WebViewGuest* guest) { 264 bool WebViewInternalSetNameFunction::RunAsyncSafe(WebViewGuest* guest) {
262 scoped_ptr<webview::SetName::Params> params( 265 scoped_ptr<web_view_internal::SetName::Params> params(
263 webview::SetName::Params::Create(*args_)); 266 web_view_internal::SetName::Params::Create(*args_));
264 EXTENSION_FUNCTION_VALIDATE(params.get()); 267 EXTENSION_FUNCTION_VALIDATE(params.get());
265 guest->SetName(params->frame_name); 268 guest->SetName(params->frame_name);
266 SendResponse(true); 269 SendResponse(true);
267 return true; 270 return true;
268 } 271 }
269 272
270 WebViewInternalSetAllowTransparencyFunction:: 273 WebViewInternalSetAllowTransparencyFunction::
271 WebViewInternalSetAllowTransparencyFunction() { 274 WebViewInternalSetAllowTransparencyFunction() {
272 } 275 }
273 276
274 WebViewInternalSetAllowTransparencyFunction:: 277 WebViewInternalSetAllowTransparencyFunction::
275 ~WebViewInternalSetAllowTransparencyFunction() { 278 ~WebViewInternalSetAllowTransparencyFunction() {
276 } 279 }
277 280
278 bool WebViewInternalSetAllowTransparencyFunction::RunAsyncSafe( 281 bool WebViewInternalSetAllowTransparencyFunction::RunAsyncSafe(
279 WebViewGuest* guest) { 282 WebViewGuest* guest) {
280 scoped_ptr<webview::SetAllowTransparency::Params> params( 283 scoped_ptr<web_view_internal::SetAllowTransparency::Params> params(
281 webview::SetAllowTransparency::Params::Create(*args_)); 284 web_view_internal::SetAllowTransparency::Params::Create(*args_));
282 EXTENSION_FUNCTION_VALIDATE(params.get()); 285 EXTENSION_FUNCTION_VALIDATE(params.get());
283 guest->SetAllowTransparency(params->allow); 286 guest->SetAllowTransparency(params->allow);
284 SendResponse(true); 287 SendResponse(true);
285 return true; 288 return true;
286 } 289 }
287 290
288 WebViewInternalSetAllowScalingFunction:: 291 WebViewInternalSetAllowScalingFunction::
289 WebViewInternalSetAllowScalingFunction() { 292 WebViewInternalSetAllowScalingFunction() {
290 } 293 }
291 294
292 WebViewInternalSetAllowScalingFunction:: 295 WebViewInternalSetAllowScalingFunction::
293 ~WebViewInternalSetAllowScalingFunction() { 296 ~WebViewInternalSetAllowScalingFunction() {
294 } 297 }
295 298
296 bool WebViewInternalSetAllowScalingFunction::RunAsyncSafe(WebViewGuest* guest) { 299 bool WebViewInternalSetAllowScalingFunction::RunAsyncSafe(WebViewGuest* guest) {
297 scoped_ptr<webview::SetAllowScaling::Params> params( 300 scoped_ptr<web_view_internal::SetAllowScaling::Params> params(
298 webview::SetAllowScaling::Params::Create(*args_)); 301 web_view_internal::SetAllowScaling::Params::Create(*args_));
299 EXTENSION_FUNCTION_VALIDATE(params.get()); 302 EXTENSION_FUNCTION_VALIDATE(params.get());
300 guest->SetAllowScaling(params->allow); 303 guest->SetAllowScaling(params->allow);
301 SendResponse(true); 304 SendResponse(true);
302 return true; 305 return true;
303 } 306 }
304 307
305 WebViewInternalSetZoomFunction::WebViewInternalSetZoomFunction() { 308 WebViewInternalSetZoomFunction::WebViewInternalSetZoomFunction() {
306 } 309 }
307 310
308 WebViewInternalSetZoomFunction::~WebViewInternalSetZoomFunction() { 311 WebViewInternalSetZoomFunction::~WebViewInternalSetZoomFunction() {
309 } 312 }
310 313
311 bool WebViewInternalSetZoomFunction::RunAsyncSafe(WebViewGuest* guest) { 314 bool WebViewInternalSetZoomFunction::RunAsyncSafe(WebViewGuest* guest) {
312 scoped_ptr<webview::SetZoom::Params> params( 315 scoped_ptr<web_view_internal::SetZoom::Params> params(
313 webview::SetZoom::Params::Create(*args_)); 316 web_view_internal::SetZoom::Params::Create(*args_));
314 EXTENSION_FUNCTION_VALIDATE(params.get()); 317 EXTENSION_FUNCTION_VALIDATE(params.get());
315 guest->SetZoom(params->zoom_factor); 318 guest->SetZoom(params->zoom_factor);
316 319
317 SendResponse(true); 320 SendResponse(true);
318 return true; 321 return true;
319 } 322 }
320 323
321 WebViewInternalGetZoomFunction::WebViewInternalGetZoomFunction() { 324 WebViewInternalGetZoomFunction::WebViewInternalGetZoomFunction() {
322 } 325 }
323 326
324 WebViewInternalGetZoomFunction::~WebViewInternalGetZoomFunction() { 327 WebViewInternalGetZoomFunction::~WebViewInternalGetZoomFunction() {
325 } 328 }
326 329
327 bool WebViewInternalGetZoomFunction::RunAsyncSafe(WebViewGuest* guest) { 330 bool WebViewInternalGetZoomFunction::RunAsyncSafe(WebViewGuest* guest) {
328 scoped_ptr<webview::GetZoom::Params> params( 331 scoped_ptr<web_view_internal::GetZoom::Params> params(
329 webview::GetZoom::Params::Create(*args_)); 332 web_view_internal::GetZoom::Params::Create(*args_));
330 EXTENSION_FUNCTION_VALIDATE(params.get()); 333 EXTENSION_FUNCTION_VALIDATE(params.get());
331 334
332 double zoom_factor = guest->zoom(); 335 double zoom_factor = guest->zoom();
333 SetResult(new base::FundamentalValue(zoom_factor)); 336 SetResult(new base::FundamentalValue(zoom_factor));
334 SendResponse(true); 337 SendResponse(true);
335 return true; 338 return true;
336 } 339 }
337 340
338 WebViewInternalFindFunction::WebViewInternalFindFunction() { 341 WebViewInternalFindFunction::WebViewInternalFindFunction() {
339 } 342 }
340 343
341 WebViewInternalFindFunction::~WebViewInternalFindFunction() { 344 WebViewInternalFindFunction::~WebViewInternalFindFunction() {
342 } 345 }
343 346
344 bool WebViewInternalFindFunction::RunAsyncSafe(WebViewGuest* guest) { 347 bool WebViewInternalFindFunction::RunAsyncSafe(WebViewGuest* guest) {
345 scoped_ptr<webview::Find::Params> params( 348 scoped_ptr<web_view_internal::Find::Params> params(
346 webview::Find::Params::Create(*args_)); 349 web_view_internal::Find::Params::Create(*args_));
347 EXTENSION_FUNCTION_VALIDATE(params.get()); 350 EXTENSION_FUNCTION_VALIDATE(params.get());
348 351
349 // Convert the std::string search_text to string16. 352 // Convert the std::string search_text to string16.
350 base::string16 search_text; 353 base::string16 search_text;
351 base::UTF8ToUTF16( 354 base::UTF8ToUTF16(
352 params->search_text.c_str(), params->search_text.length(), &search_text); 355 params->search_text.c_str(), params->search_text.length(), &search_text);
353 356
354 // Set the find options to their default values. 357 // Set the find options to their default values.
355 blink::WebFindOptions options; 358 blink::WebFindOptions options;
356 if (params->options) { 359 if (params->options) {
357 options.forward = 360 options.forward =
358 params->options->backward ? !*params->options->backward : true; 361 params->options->backward ? !*params->options->backward : true;
359 options.matchCase = 362 options.matchCase =
360 params->options->match_case ? *params->options->match_case : false; 363 params->options->match_case ? *params->options->match_case : false;
361 } 364 }
362 365
363 guest->StartFindInternal(search_text, options, this); 366 guest->StartFindInternal(search_text, options, this);
364 return true; 367 return true;
365 } 368 }
366 369
367 WebViewInternalStopFindingFunction::WebViewInternalStopFindingFunction() { 370 WebViewInternalStopFindingFunction::WebViewInternalStopFindingFunction() {
368 } 371 }
369 372
370 WebViewInternalStopFindingFunction::~WebViewInternalStopFindingFunction() { 373 WebViewInternalStopFindingFunction::~WebViewInternalStopFindingFunction() {
371 } 374 }
372 375
373 bool WebViewInternalStopFindingFunction::RunAsyncSafe(WebViewGuest* guest) { 376 bool WebViewInternalStopFindingFunction::RunAsyncSafe(WebViewGuest* guest) {
374 scoped_ptr<webview::StopFinding::Params> params( 377 scoped_ptr<web_view_internal::StopFinding::Params> params(
375 webview::StopFinding::Params::Create(*args_)); 378 web_view_internal::StopFinding::Params::Create(*args_));
376 EXTENSION_FUNCTION_VALIDATE(params.get()); 379 EXTENSION_FUNCTION_VALIDATE(params.get());
377 380
378 // Set the StopFindAction. 381 // Set the StopFindAction.
379 content::StopFindAction action; 382 content::StopFindAction action;
380 switch (params->action) { 383 switch (params->action) {
381 case webview::StopFinding::Params::ACTION_CLEAR: 384 case web_view_internal::StopFinding::Params::ACTION_CLEAR:
382 action = content::STOP_FIND_ACTION_CLEAR_SELECTION; 385 action = content::STOP_FIND_ACTION_CLEAR_SELECTION;
383 break; 386 break;
384 case webview::StopFinding::Params::ACTION_KEEP: 387 case web_view_internal::StopFinding::Params::ACTION_KEEP:
385 action = content::STOP_FIND_ACTION_KEEP_SELECTION; 388 action = content::STOP_FIND_ACTION_KEEP_SELECTION;
386 break; 389 break;
387 case webview::StopFinding::Params::ACTION_ACTIVATE: 390 case web_view_internal::StopFinding::Params::ACTION_ACTIVATE:
388 action = content::STOP_FIND_ACTION_ACTIVATE_SELECTION; 391 action = content::STOP_FIND_ACTION_ACTIVATE_SELECTION;
389 break; 392 break;
390 default: 393 default:
391 action = content::STOP_FIND_ACTION_KEEP_SELECTION; 394 action = content::STOP_FIND_ACTION_KEEP_SELECTION;
392 } 395 }
393 396
394 guest->StopFindingInternal(action); 397 guest->StopFindingInternal(action);
395 return true; 398 return true;
396 } 399 }
397 400
398 WebViewInternalLoadDataWithBaseUrlFunction:: 401 WebViewInternalLoadDataWithBaseUrlFunction::
399 WebViewInternalLoadDataWithBaseUrlFunction() { 402 WebViewInternalLoadDataWithBaseUrlFunction() {
400 } 403 }
401 404
402 WebViewInternalLoadDataWithBaseUrlFunction:: 405 WebViewInternalLoadDataWithBaseUrlFunction::
403 ~WebViewInternalLoadDataWithBaseUrlFunction() { 406 ~WebViewInternalLoadDataWithBaseUrlFunction() {
404 } 407 }
405 408
406 bool WebViewInternalLoadDataWithBaseUrlFunction::RunAsyncSafe( 409 bool WebViewInternalLoadDataWithBaseUrlFunction::RunAsyncSafe(
407 WebViewGuest* guest) { 410 WebViewGuest* guest) {
408 scoped_ptr<webview::LoadDataWithBaseUrl::Params> params( 411 scoped_ptr<web_view_internal::LoadDataWithBaseUrl::Params> params(
409 webview::LoadDataWithBaseUrl::Params::Create(*args_)); 412 web_view_internal::LoadDataWithBaseUrl::Params::Create(*args_));
410 EXTENSION_FUNCTION_VALIDATE(params.get()); 413 EXTENSION_FUNCTION_VALIDATE(params.get());
411 414
412 // If a virtual URL was provided, use it. Otherwise, the user will be shown 415 // If a virtual URL was provided, use it. Otherwise, the user will be shown
413 // the data URL. 416 // the data URL.
414 std::string virtual_url = 417 std::string virtual_url =
415 params->virtual_url ? *params->virtual_url : params->data_url; 418 params->virtual_url ? *params->virtual_url : params->data_url;
416 419
417 bool successful = guest->LoadDataWithBaseURL( 420 bool successful = guest->LoadDataWithBaseURL(
418 params->data_url, params->base_url, virtual_url, &error_); 421 params->data_url, params->base_url, virtual_url, &error_);
419 SendResponse(successful); 422 SendResponse(successful);
420 return successful; 423 return successful;
421 } 424 }
422 425
423 WebViewInternalGoFunction::WebViewInternalGoFunction() { 426 WebViewInternalGoFunction::WebViewInternalGoFunction() {
424 } 427 }
425 428
426 WebViewInternalGoFunction::~WebViewInternalGoFunction() { 429 WebViewInternalGoFunction::~WebViewInternalGoFunction() {
427 } 430 }
428 431
429 bool WebViewInternalGoFunction::RunAsyncSafe(WebViewGuest* guest) { 432 bool WebViewInternalGoFunction::RunAsyncSafe(WebViewGuest* guest) {
430 scoped_ptr<webview::Go::Params> params(webview::Go::Params::Create(*args_)); 433 scoped_ptr<web_view_internal::Go::Params> params(
434 web_view_internal::Go::Params::Create(*args_));
431 EXTENSION_FUNCTION_VALIDATE(params.get()); 435 EXTENSION_FUNCTION_VALIDATE(params.get());
432 436
433 bool successful = guest->Go(params->relative_index); 437 bool successful = guest->Go(params->relative_index);
434 SetResult(new base::FundamentalValue(successful)); 438 SetResult(new base::FundamentalValue(successful));
435 SendResponse(true); 439 SendResponse(true);
436 return true; 440 return true;
437 } 441 }
438 442
439 WebViewInternalReloadFunction::WebViewInternalReloadFunction() { 443 WebViewInternalReloadFunction::WebViewInternalReloadFunction() {
440 } 444 }
441 445
442 WebViewInternalReloadFunction::~WebViewInternalReloadFunction() { 446 WebViewInternalReloadFunction::~WebViewInternalReloadFunction() {
443 } 447 }
444 448
445 bool WebViewInternalReloadFunction::RunAsyncSafe(WebViewGuest* guest) { 449 bool WebViewInternalReloadFunction::RunAsyncSafe(WebViewGuest* guest) {
446 guest->Reload(); 450 guest->Reload();
447 return true; 451 return true;
448 } 452 }
449 453
450 WebViewInternalSetPermissionFunction::WebViewInternalSetPermissionFunction() { 454 WebViewInternalSetPermissionFunction::WebViewInternalSetPermissionFunction() {
451 } 455 }
452 456
453 WebViewInternalSetPermissionFunction::~WebViewInternalSetPermissionFunction() { 457 WebViewInternalSetPermissionFunction::~WebViewInternalSetPermissionFunction() {
454 } 458 }
455 459
456 bool WebViewInternalSetPermissionFunction::RunAsyncSafe(WebViewGuest* guest) { 460 bool WebViewInternalSetPermissionFunction::RunAsyncSafe(WebViewGuest* guest) {
457 scoped_ptr<webview::SetPermission::Params> params( 461 scoped_ptr<web_view_internal::SetPermission::Params> params(
458 webview::SetPermission::Params::Create(*args_)); 462 web_view_internal::SetPermission::Params::Create(*args_));
459 EXTENSION_FUNCTION_VALIDATE(params.get()); 463 EXTENSION_FUNCTION_VALIDATE(params.get());
460 464
461 WebViewPermissionHelper::PermissionResponseAction action = 465 WebViewPermissionHelper::PermissionResponseAction action =
462 WebViewPermissionHelper::DEFAULT; 466 WebViewPermissionHelper::DEFAULT;
463 switch (params->action) { 467 switch (params->action) {
464 case Params::ACTION_ALLOW: 468 case Params::ACTION_ALLOW:
465 action = WebViewPermissionHelper::ALLOW; 469 action = WebViewPermissionHelper::ALLOW;
466 break; 470 break;
467 case Params::ACTION_DENY: 471 case Params::ACTION_DENY:
468 action = WebViewPermissionHelper::DENY; 472 action = WebViewPermissionHelper::DENY;
(...skipping 27 matching lines...) Expand all
496 WebViewInternalOverrideUserAgentFunction:: 500 WebViewInternalOverrideUserAgentFunction::
497 WebViewInternalOverrideUserAgentFunction() { 501 WebViewInternalOverrideUserAgentFunction() {
498 } 502 }
499 503
500 WebViewInternalOverrideUserAgentFunction:: 504 WebViewInternalOverrideUserAgentFunction::
501 ~WebViewInternalOverrideUserAgentFunction() { 505 ~WebViewInternalOverrideUserAgentFunction() {
502 } 506 }
503 507
504 bool WebViewInternalOverrideUserAgentFunction::RunAsyncSafe( 508 bool WebViewInternalOverrideUserAgentFunction::RunAsyncSafe(
505 WebViewGuest* guest) { 509 WebViewGuest* guest) {
506 scoped_ptr<webview::OverrideUserAgent::Params> params( 510 scoped_ptr<web_view_internal::OverrideUserAgent::Params> params(
507 webview::OverrideUserAgent::Params::Create(*args_)); 511 web_view_internal::OverrideUserAgent::Params::Create(*args_));
508 EXTENSION_FUNCTION_VALIDATE(params.get()); 512 EXTENSION_FUNCTION_VALIDATE(params.get());
509 513
510 guest->SetUserAgentOverride(params->user_agent_override); 514 guest->SetUserAgentOverride(params->user_agent_override);
511 return true; 515 return true;
512 } 516 }
513 517
514 WebViewInternalStopFunction::WebViewInternalStopFunction() { 518 WebViewInternalStopFunction::WebViewInternalStopFunction() {
515 } 519 }
516 520
517 WebViewInternalStopFunction::~WebViewInternalStopFunction() { 521 WebViewInternalStopFunction::~WebViewInternalStopFunction() {
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 // Will finish asynchronously. 613 // Will finish asynchronously.
610 return true; 614 return true;
611 } 615 }
612 616
613 void WebViewInternalClearDataFunction::ClearDataDone() { 617 void WebViewInternalClearDataFunction::ClearDataDone() {
614 Release(); // Balanced in RunAsync(). 618 Release(); // Balanced in RunAsync().
615 SendResponse(true); 619 SendResponse(true);
616 } 620 }
617 621
618 } // namespace extensions 622 } // namespace extensions
OLDNEW
« no previous file with comments | « components/web_cache/browser/web_cache_manager.cc ('k') | extensions/browser/guest_view/web_view/web_view_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698