OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/browser/extensions/api/webview/webview_api.h" | 5 #include "chrome/browser/extensions/api/webview/webview_api.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/browser/extensions/api/browsing_data/browsing_data_api.h" | 8 #include "chrome/browser/extensions/api/browsing_data/browsing_data_api.h" |
9 #include "chrome/browser/extensions/api/context_menus/context_menus_api.h" | 9 #include "chrome/browser/extensions/api/context_menus/context_menus_api.h" |
10 #include "chrome/browser/extensions/api/context_menus/context_menus_api_helpers.
h" | 10 #include "chrome/browser/extensions/api/context_menus/context_menus_api_helpers.
h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 return content::StoragePartition::REMOVE_DATA_MASK_INDEXEDDB; | 39 return content::StoragePartition::REMOVE_DATA_MASK_INDEXEDDB; |
40 if (strcmp(key, extension_browsing_data_api_constants::kLocalStorageKey) == 0) | 40 if (strcmp(key, extension_browsing_data_api_constants::kLocalStorageKey) == 0) |
41 return content::StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE; | 41 return content::StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE; |
42 if (strcmp(key, extension_browsing_data_api_constants::kWebSQLKey) == 0) | 42 if (strcmp(key, extension_browsing_data_api_constants::kWebSQLKey) == 0) |
43 return content::StoragePartition::REMOVE_DATA_MASK_WEBSQL; | 43 return content::StoragePartition::REMOVE_DATA_MASK_WEBSQL; |
44 return 0; | 44 return 0; |
45 } | 45 } |
46 | 46 |
47 } // namespace | 47 } // namespace |
48 | 48 |
49 bool WebviewExtensionFunction::RunImpl() { | 49 bool WebviewExtensionFunction::RunAsync() { |
50 int instance_id = 0; | 50 int instance_id = 0; |
51 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &instance_id)); | 51 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &instance_id)); |
52 WebViewGuest* guest = WebViewGuest::From( | 52 WebViewGuest* guest = WebViewGuest::From( |
53 render_view_host()->GetProcess()->GetID(), instance_id); | 53 render_view_host()->GetProcess()->GetID(), instance_id); |
54 if (!guest) | 54 if (!guest) |
55 return false; | 55 return false; |
56 | 56 |
57 return RunImplSafe(guest); | 57 return RunAsyncSafe(guest); |
58 } | 58 } |
59 | 59 |
60 // TODO(lazyboy): Add checks similar to | 60 // TODO(lazyboy): Add checks similar to |
61 // WebviewExtensionFunction::RunImplSafe(WebViewGuest*). | 61 // WebviewExtensionFunction::RunAsyncSafe(WebViewGuest*). |
62 bool WebviewContextMenusCreateFunction::RunImpl() { | 62 bool WebviewContextMenusCreateFunction::RunAsync() { |
63 scoped_ptr<webview::ContextMenusCreate::Params> params( | 63 scoped_ptr<webview::ContextMenusCreate::Params> params( |
64 webview::ContextMenusCreate::Params::Create(*args_)); | 64 webview::ContextMenusCreate::Params::Create(*args_)); |
65 EXTENSION_FUNCTION_VALIDATE(params.get()); | 65 EXTENSION_FUNCTION_VALIDATE(params.get()); |
66 | 66 |
67 MenuItem::Id id( | 67 MenuItem::Id id( |
68 Profile::FromBrowserContext(browser_context())->IsOffTheRecord(), | 68 Profile::FromBrowserContext(browser_context())->IsOffTheRecord(), |
69 MenuItem::ExtensionKey(extension_id(), params->instance_id)); | 69 MenuItem::ExtensionKey(extension_id(), params->instance_id)); |
70 | 70 |
71 if (params->create_properties.id.get()) { | 71 if (params->create_properties.id.get()) { |
72 id.string_uid = *params->create_properties.id; | 72 id.string_uid = *params->create_properties.id; |
73 } else { | 73 } else { |
74 // The Generated Id is added by webview_custom_bindings.js. | 74 // The Generated Id is added by webview_custom_bindings.js. |
75 base::DictionaryValue* properties = NULL; | 75 base::DictionaryValue* properties = NULL; |
76 EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(1, &properties)); | 76 EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(1, &properties)); |
77 EXTENSION_FUNCTION_VALIDATE( | 77 EXTENSION_FUNCTION_VALIDATE( |
78 properties->GetInteger(helpers::kGeneratedIdKey, &id.uid)); | 78 properties->GetInteger(helpers::kGeneratedIdKey, &id.uid)); |
79 } | 79 } |
80 | 80 |
81 bool success = extensions::context_menus_api_helpers::CreateMenuItem( | 81 bool success = extensions::context_menus_api_helpers::CreateMenuItem( |
82 params->create_properties, | 82 params->create_properties, |
83 Profile::FromBrowserContext(browser_context()), | 83 Profile::FromBrowserContext(browser_context()), |
84 GetExtension(), | 84 GetExtension(), |
85 id, | 85 id, |
86 &error_); | 86 &error_); |
87 | 87 |
88 SendResponse(success); | 88 SendResponse(success); |
89 return success; | 89 return success; |
90 } | 90 } |
91 | 91 |
92 bool WebviewContextMenusUpdateFunction::RunImpl() { | 92 bool WebviewContextMenusUpdateFunction::RunAsync() { |
93 scoped_ptr<webview::ContextMenusUpdate::Params> params( | 93 scoped_ptr<webview::ContextMenusUpdate::Params> params( |
94 webview::ContextMenusUpdate::Params::Create(*args_)); | 94 webview::ContextMenusUpdate::Params::Create(*args_)); |
95 EXTENSION_FUNCTION_VALIDATE(params.get()); | 95 EXTENSION_FUNCTION_VALIDATE(params.get()); |
96 | 96 |
97 Profile* profile = Profile::FromBrowserContext(browser_context()); | 97 Profile* profile = Profile::FromBrowserContext(browser_context()); |
98 MenuItem::Id item_id( | 98 MenuItem::Id item_id( |
99 profile->IsOffTheRecord(), | 99 profile->IsOffTheRecord(), |
100 MenuItem::ExtensionKey(extension_id(), params->instance_id)); | 100 MenuItem::ExtensionKey(extension_id(), params->instance_id)); |
101 | 101 |
102 if (params->id.as_string) | 102 if (params->id.as_string) |
103 item_id.string_uid = *params->id.as_string; | 103 item_id.string_uid = *params->id.as_string; |
104 else if (params->id.as_integer) | 104 else if (params->id.as_integer) |
105 item_id.uid = *params->id.as_integer; | 105 item_id.uid = *params->id.as_integer; |
106 else | 106 else |
107 NOTREACHED(); | 107 NOTREACHED(); |
108 | 108 |
109 bool success = extensions::context_menus_api_helpers::UpdateMenuItem( | 109 bool success = extensions::context_menus_api_helpers::UpdateMenuItem( |
110 params->update_properties, profile, GetExtension(), item_id, &error_); | 110 params->update_properties, profile, GetExtension(), item_id, &error_); |
111 SendResponse(success); | 111 SendResponse(success); |
112 return success; | 112 return success; |
113 } | 113 } |
114 | 114 |
115 bool WebviewContextMenusRemoveFunction::RunImpl() { | 115 bool WebviewContextMenusRemoveFunction::RunAsync() { |
116 scoped_ptr<webview::ContextMenusRemove::Params> params( | 116 scoped_ptr<webview::ContextMenusRemove::Params> params( |
117 webview::ContextMenusRemove::Params::Create(*args_)); | 117 webview::ContextMenusRemove::Params::Create(*args_)); |
118 EXTENSION_FUNCTION_VALIDATE(params.get()); | 118 EXTENSION_FUNCTION_VALIDATE(params.get()); |
119 | 119 |
120 MenuManager* menu_manager = | 120 MenuManager* menu_manager = |
121 MenuManager::Get(Profile::FromBrowserContext(browser_context())); | 121 MenuManager::Get(Profile::FromBrowserContext(browser_context())); |
122 | 122 |
123 MenuItem::Id id( | 123 MenuItem::Id id( |
124 Profile::FromBrowserContext(browser_context())->IsOffTheRecord(), | 124 Profile::FromBrowserContext(browser_context())->IsOffTheRecord(), |
125 MenuItem::ExtensionKey(extension_id(), params->instance_id)); | 125 MenuItem::ExtensionKey(extension_id(), params->instance_id)); |
(...skipping 15 matching lines...) Expand all Loading... |
141 context_menus_api_helpers::GetIDString(id)); | 141 context_menus_api_helpers::GetIDString(id)); |
142 success = false; | 142 success = false; |
143 } else if (!menu_manager->RemoveContextMenuItem(id)) { | 143 } else if (!menu_manager->RemoveContextMenuItem(id)) { |
144 success = false; | 144 success = false; |
145 } | 145 } |
146 | 146 |
147 SendResponse(success); | 147 SendResponse(success); |
148 return success; | 148 return success; |
149 } | 149 } |
150 | 150 |
151 bool WebviewContextMenusRemoveAllFunction::RunImpl() { | 151 bool WebviewContextMenusRemoveAllFunction::RunAsync() { |
152 scoped_ptr<webview::ContextMenusRemoveAll::Params> params( | 152 scoped_ptr<webview::ContextMenusRemoveAll::Params> params( |
153 webview::ContextMenusRemoveAll::Params::Create(*args_)); | 153 webview::ContextMenusRemoveAll::Params::Create(*args_)); |
154 EXTENSION_FUNCTION_VALIDATE(params.get()); | 154 EXTENSION_FUNCTION_VALIDATE(params.get()); |
155 | 155 |
156 MenuManager* menu_manager = | 156 MenuManager* menu_manager = |
157 MenuManager::Get(Profile::FromBrowserContext(browser_context())); | 157 MenuManager::Get(Profile::FromBrowserContext(browser_context())); |
158 | 158 |
159 int webview_instance_id = params->instance_id; | 159 int webview_instance_id = params->instance_id; |
160 menu_manager->RemoveAllContextItems( | 160 menu_manager->RemoveAllContextItems( |
161 MenuItem::ExtensionKey(GetExtension()->id(), webview_instance_id)); | 161 MenuItem::ExtensionKey(GetExtension()->id(), webview_instance_id)); |
(...skipping 27 matching lines...) Expand all Loading... |
189 } | 189 } |
190 if (selected) | 190 if (selected) |
191 remove_mask |= MaskForKey(i.key().c_str()); | 191 remove_mask |= MaskForKey(i.key().c_str()); |
192 } | 192 } |
193 | 193 |
194 return remove_mask; | 194 return remove_mask; |
195 } | 195 } |
196 | 196 |
197 // TODO(lazyboy): Parameters in this extension function are similar (or a | 197 // TODO(lazyboy): Parameters in this extension function are similar (or a |
198 // sub-set) to BrowsingDataRemoverFunction. How can we share this code? | 198 // sub-set) to BrowsingDataRemoverFunction. How can we share this code? |
199 bool WebviewClearDataFunction::RunImplSafe(WebViewGuest* guest) { | 199 bool WebviewClearDataFunction::RunAsyncSafe(WebViewGuest* guest) { |
200 // Grab the initial |options| parameter, and parse out the arguments. | 200 // Grab the initial |options| parameter, and parse out the arguments. |
201 base::DictionaryValue* options; | 201 base::DictionaryValue* options; |
202 EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(1, &options)); | 202 EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(1, &options)); |
203 DCHECK(options); | 203 DCHECK(options); |
204 | 204 |
205 // If |ms_since_epoch| isn't set, default it to 0. | 205 // If |ms_since_epoch| isn't set, default it to 0. |
206 double ms_since_epoch; | 206 double ms_since_epoch; |
207 if (!options->GetDouble(extension_browsing_data_api_constants::kSinceKey, | 207 if (!options->GetDouble(extension_browsing_data_api_constants::kSinceKey, |
208 &ms_since_epoch)) { | 208 &ms_since_epoch)) { |
209 ms_since_epoch = 0; | 209 ms_since_epoch = 0; |
(...skipping 25 matching lines...) Expand all Loading... |
235 SendResponse(false); | 235 SendResponse(false); |
236 Release(); // Balanced above. | 236 Release(); // Balanced above. |
237 return false; | 237 return false; |
238 } | 238 } |
239 | 239 |
240 // Will finish asynchronously. | 240 // Will finish asynchronously. |
241 return true; | 241 return true; |
242 } | 242 } |
243 | 243 |
244 void WebviewClearDataFunction::ClearDataDone() { | 244 void WebviewClearDataFunction::ClearDataDone() { |
245 Release(); // Balanced in RunImpl(). | 245 Release(); // Balanced in RunAsync(). |
246 SendResponse(true); | 246 SendResponse(true); |
247 } | 247 } |
248 | 248 |
249 WebviewExecuteCodeFunction::WebviewExecuteCodeFunction() | 249 WebviewExecuteCodeFunction::WebviewExecuteCodeFunction() |
250 : guest_instance_id_(0), guest_src_(GURL::EmptyGURL()) {} | 250 : guest_instance_id_(0), guest_src_(GURL::EmptyGURL()) {} |
251 | 251 |
252 WebviewExecuteCodeFunction::~WebviewExecuteCodeFunction() { | 252 WebviewExecuteCodeFunction::~WebviewExecuteCodeFunction() { |
253 } | 253 } |
254 | 254 |
255 bool WebviewExecuteCodeFunction::Init() { | 255 bool WebviewExecuteCodeFunction::Init() { |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 FailureReason reason) { | 348 FailureReason reason) { |
349 SendResponse(false); | 349 SendResponse(false); |
350 } | 350 } |
351 | 351 |
352 WebviewSetZoomFunction::WebviewSetZoomFunction() { | 352 WebviewSetZoomFunction::WebviewSetZoomFunction() { |
353 } | 353 } |
354 | 354 |
355 WebviewSetZoomFunction::~WebviewSetZoomFunction() { | 355 WebviewSetZoomFunction::~WebviewSetZoomFunction() { |
356 } | 356 } |
357 | 357 |
358 bool WebviewSetZoomFunction::RunImplSafe(WebViewGuest* guest) { | 358 bool WebviewSetZoomFunction::RunAsyncSafe(WebViewGuest* guest) { |
359 scoped_ptr<webview::SetZoom::Params> params( | 359 scoped_ptr<webview::SetZoom::Params> params( |
360 webview::SetZoom::Params::Create(*args_)); | 360 webview::SetZoom::Params::Create(*args_)); |
361 EXTENSION_FUNCTION_VALIDATE(params.get()); | 361 EXTENSION_FUNCTION_VALIDATE(params.get()); |
362 guest->SetZoom(params->zoom_factor); | 362 guest->SetZoom(params->zoom_factor); |
363 | 363 |
364 SendResponse(true); | 364 SendResponse(true); |
365 return true; | 365 return true; |
366 } | 366 } |
367 | 367 |
368 WebviewGetZoomFunction::WebviewGetZoomFunction() { | 368 WebviewGetZoomFunction::WebviewGetZoomFunction() { |
369 } | 369 } |
370 | 370 |
371 WebviewGetZoomFunction::~WebviewGetZoomFunction() { | 371 WebviewGetZoomFunction::~WebviewGetZoomFunction() { |
372 } | 372 } |
373 | 373 |
374 bool WebviewGetZoomFunction::RunImplSafe(WebViewGuest* guest) { | 374 bool WebviewGetZoomFunction::RunAsyncSafe(WebViewGuest* guest) { |
375 scoped_ptr<webview::GetZoom::Params> params( | 375 scoped_ptr<webview::GetZoom::Params> params( |
376 webview::GetZoom::Params::Create(*args_)); | 376 webview::GetZoom::Params::Create(*args_)); |
377 EXTENSION_FUNCTION_VALIDATE(params.get()); | 377 EXTENSION_FUNCTION_VALIDATE(params.get()); |
378 | 378 |
379 double zoom_factor = guest->GetZoom(); | 379 double zoom_factor = guest->GetZoom(); |
380 SetResult(base::Value::CreateDoubleValue(zoom_factor)); | 380 SetResult(base::Value::CreateDoubleValue(zoom_factor)); |
381 SendResponse(true); | 381 SendResponse(true); |
382 return true; | 382 return true; |
383 } | 383 } |
384 | 384 |
385 WebviewFindFunction::WebviewFindFunction() { | 385 WebviewFindFunction::WebviewFindFunction() { |
386 } | 386 } |
387 | 387 |
388 WebviewFindFunction::~WebviewFindFunction() { | 388 WebviewFindFunction::~WebviewFindFunction() { |
389 } | 389 } |
390 | 390 |
391 bool WebviewFindFunction::RunImplSafe(WebViewGuest* guest) { | 391 bool WebviewFindFunction::RunAsyncSafe(WebViewGuest* guest) { |
392 scoped_ptr<webview::Find::Params> params( | 392 scoped_ptr<webview::Find::Params> params( |
393 webview::Find::Params::Create(*args_)); | 393 webview::Find::Params::Create(*args_)); |
394 EXTENSION_FUNCTION_VALIDATE(params.get()); | 394 EXTENSION_FUNCTION_VALIDATE(params.get()); |
395 | 395 |
396 // Convert the std::string search_text to string16. | 396 // Convert the std::string search_text to string16. |
397 base::string16 search_text; | 397 base::string16 search_text; |
398 base::UTF8ToUTF16(params->search_text.c_str(), | 398 base::UTF8ToUTF16(params->search_text.c_str(), |
399 params->search_text.length(), | 399 params->search_text.length(), |
400 &search_text); | 400 &search_text); |
401 | 401 |
402 // Set the find options to their default values. | 402 // Set the find options to their default values. |
403 blink::WebFindOptions options; | 403 blink::WebFindOptions options; |
404 if (params->options) { | 404 if (params->options) { |
405 options.forward = | 405 options.forward = |
406 params->options->backward ? !*params->options->backward : true; | 406 params->options->backward ? !*params->options->backward : true; |
407 options.matchCase = | 407 options.matchCase = |
408 params->options->match_case ? *params->options->match_case : false; | 408 params->options->match_case ? *params->options->match_case : false; |
409 } | 409 } |
410 | 410 |
411 guest->Find(search_text, options, this); | 411 guest->Find(search_text, options, this); |
412 return true; | 412 return true; |
413 } | 413 } |
414 | 414 |
415 WebviewStopFindingFunction::WebviewStopFindingFunction() { | 415 WebviewStopFindingFunction::WebviewStopFindingFunction() { |
416 } | 416 } |
417 | 417 |
418 WebviewStopFindingFunction::~WebviewStopFindingFunction() { | 418 WebviewStopFindingFunction::~WebviewStopFindingFunction() { |
419 } | 419 } |
420 | 420 |
421 bool WebviewStopFindingFunction::RunImplSafe(WebViewGuest* guest) { | 421 bool WebviewStopFindingFunction::RunAsyncSafe(WebViewGuest* guest) { |
422 scoped_ptr<webview::StopFinding::Params> params( | 422 scoped_ptr<webview::StopFinding::Params> params( |
423 webview::StopFinding::Params::Create(*args_)); | 423 webview::StopFinding::Params::Create(*args_)); |
424 EXTENSION_FUNCTION_VALIDATE(params.get()); | 424 EXTENSION_FUNCTION_VALIDATE(params.get()); |
425 | 425 |
426 // Set the StopFindAction. | 426 // Set the StopFindAction. |
427 content::StopFindAction action; | 427 content::StopFindAction action; |
428 switch (params->action) { | 428 switch (params->action) { |
429 case webview::StopFinding::Params::ACTION_CLEAR: | 429 case webview::StopFinding::Params::ACTION_CLEAR: |
430 action = content::STOP_FIND_ACTION_CLEAR_SELECTION; | 430 action = content::STOP_FIND_ACTION_CLEAR_SELECTION; |
431 break; | 431 break; |
(...skipping 10 matching lines...) Expand all Loading... |
442 guest->StopFinding(action); | 442 guest->StopFinding(action); |
443 return true; | 443 return true; |
444 } | 444 } |
445 | 445 |
446 WebviewGoFunction::WebviewGoFunction() { | 446 WebviewGoFunction::WebviewGoFunction() { |
447 } | 447 } |
448 | 448 |
449 WebviewGoFunction::~WebviewGoFunction() { | 449 WebviewGoFunction::~WebviewGoFunction() { |
450 } | 450 } |
451 | 451 |
452 bool WebviewGoFunction::RunImplSafe(WebViewGuest* guest) { | 452 bool WebviewGoFunction::RunAsyncSafe(WebViewGuest* guest) { |
453 scoped_ptr<webview::Go::Params> params(webview::Go::Params::Create(*args_)); | 453 scoped_ptr<webview::Go::Params> params(webview::Go::Params::Create(*args_)); |
454 EXTENSION_FUNCTION_VALIDATE(params.get()); | 454 EXTENSION_FUNCTION_VALIDATE(params.get()); |
455 | 455 |
456 guest->Go(params->relative_index); | 456 guest->Go(params->relative_index); |
457 return true; | 457 return true; |
458 } | 458 } |
459 | 459 |
460 WebviewReloadFunction::WebviewReloadFunction() { | 460 WebviewReloadFunction::WebviewReloadFunction() { |
461 } | 461 } |
462 | 462 |
463 WebviewReloadFunction::~WebviewReloadFunction() { | 463 WebviewReloadFunction::~WebviewReloadFunction() { |
464 } | 464 } |
465 | 465 |
466 bool WebviewReloadFunction::RunImplSafe(WebViewGuest* guest) { | 466 bool WebviewReloadFunction::RunAsyncSafe(WebViewGuest* guest) { |
467 guest->Reload(); | 467 guest->Reload(); |
468 return true; | 468 return true; |
469 } | 469 } |
470 | 470 |
471 WebviewSetPermissionFunction::WebviewSetPermissionFunction() { | 471 WebviewSetPermissionFunction::WebviewSetPermissionFunction() { |
472 } | 472 } |
473 | 473 |
474 WebviewSetPermissionFunction::~WebviewSetPermissionFunction() { | 474 WebviewSetPermissionFunction::~WebviewSetPermissionFunction() { |
475 } | 475 } |
476 | 476 |
477 bool WebviewSetPermissionFunction::RunImplSafe(WebViewGuest* guest) { | 477 bool WebviewSetPermissionFunction::RunAsyncSafe(WebViewGuest* guest) { |
478 scoped_ptr<webview::SetPermission::Params> params( | 478 scoped_ptr<webview::SetPermission::Params> params( |
479 webview::SetPermission::Params::Create(*args_)); | 479 webview::SetPermission::Params::Create(*args_)); |
480 EXTENSION_FUNCTION_VALIDATE(params.get()); | 480 EXTENSION_FUNCTION_VALIDATE(params.get()); |
481 | 481 |
482 WebViewGuest::PermissionResponseAction action = WebViewGuest::DEFAULT; | 482 WebViewGuest::PermissionResponseAction action = WebViewGuest::DEFAULT; |
483 switch (params->action) { | 483 switch (params->action) { |
484 case Params::ACTION_ALLOW: | 484 case Params::ACTION_ALLOW: |
485 action = WebViewGuest::ALLOW; | 485 action = WebViewGuest::ALLOW; |
486 break; | 486 break; |
487 case Params::ACTION_DENY: | 487 case Params::ACTION_DENY: |
(...skipping 19 matching lines...) Expand all Loading... |
507 SendResponse(true); | 507 SendResponse(true); |
508 return true; | 508 return true; |
509 } | 509 } |
510 | 510 |
511 WebviewOverrideUserAgentFunction::WebviewOverrideUserAgentFunction() { | 511 WebviewOverrideUserAgentFunction::WebviewOverrideUserAgentFunction() { |
512 } | 512 } |
513 | 513 |
514 WebviewOverrideUserAgentFunction::~WebviewOverrideUserAgentFunction() { | 514 WebviewOverrideUserAgentFunction::~WebviewOverrideUserAgentFunction() { |
515 } | 515 } |
516 | 516 |
517 bool WebviewOverrideUserAgentFunction::RunImplSafe(WebViewGuest* guest) { | 517 bool WebviewOverrideUserAgentFunction::RunAsyncSafe(WebViewGuest* guest) { |
518 scoped_ptr<extensions::api::webview::OverrideUserAgent::Params> params( | 518 scoped_ptr<extensions::api::webview::OverrideUserAgent::Params> params( |
519 extensions::api::webview::OverrideUserAgent::Params::Create(*args_)); | 519 extensions::api::webview::OverrideUserAgent::Params::Create(*args_)); |
520 EXTENSION_FUNCTION_VALIDATE(params.get()); | 520 EXTENSION_FUNCTION_VALIDATE(params.get()); |
521 | 521 |
522 guest->SetUserAgentOverride(params->user_agent_override); | 522 guest->SetUserAgentOverride(params->user_agent_override); |
523 return true; | 523 return true; |
524 } | 524 } |
525 | 525 |
526 WebviewStopFunction::WebviewStopFunction() { | 526 WebviewStopFunction::WebviewStopFunction() { |
527 } | 527 } |
528 | 528 |
529 WebviewStopFunction::~WebviewStopFunction() { | 529 WebviewStopFunction::~WebviewStopFunction() { |
530 } | 530 } |
531 | 531 |
532 bool WebviewStopFunction::RunImplSafe(WebViewGuest* guest) { | 532 bool WebviewStopFunction::RunAsyncSafe(WebViewGuest* guest) { |
533 guest->Stop(); | 533 guest->Stop(); |
534 return true; | 534 return true; |
535 } | 535 } |
536 | 536 |
537 WebviewTerminateFunction::WebviewTerminateFunction() { | 537 WebviewTerminateFunction::WebviewTerminateFunction() { |
538 } | 538 } |
539 | 539 |
540 WebviewTerminateFunction::~WebviewTerminateFunction() { | 540 WebviewTerminateFunction::~WebviewTerminateFunction() { |
541 } | 541 } |
542 | 542 |
543 bool WebviewTerminateFunction::RunImplSafe(WebViewGuest* guest) { | 543 bool WebviewTerminateFunction::RunAsyncSafe(WebViewGuest* guest) { |
544 guest->Terminate(); | 544 guest->Terminate(); |
545 return true; | 545 return true; |
546 } | 546 } |
547 | 547 |
548 } // namespace extensions | 548 } // namespace extensions |
OLD | NEW |