| OLD | NEW |
| 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/web_view/web_view_internal_api.h" | 5 #include "extensions/browser/api/web_view/web_view_internal_api.h" |
| 6 | 6 |
| 7 #include "base/strings/stringprintf.h" |
| 7 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 8 #include "content/public/browser/render_process_host.h" | 9 #include "content/public/browser/render_process_host.h" |
| 9 #include "content/public/browser/render_view_host.h" | 10 #include "content/public/browser/render_view_host.h" |
| 10 #include "content/public/browser/storage_partition.h" | 11 #include "content/public/browser/storage_partition.h" |
| 11 #include "content/public/browser/web_contents.h" | 12 #include "content/public/browser/web_contents.h" |
| 12 #include "content/public/common/stop_find_action.h" | 13 #include "content/public/common/stop_find_action.h" |
| 13 #include "extensions/common/api/web_view_internal.h" | 14 #include "extensions/common/api/web_view_internal.h" |
| 14 #include "third_party/WebKit/public/web/WebFindOptions.h" | 15 #include "third_party/WebKit/public/web/WebFindOptions.h" |
| 15 | 16 |
| 16 using content::WebContents; | 17 using content::WebContents; |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 action = content::STOP_FIND_ACTION_ACTIVATE_SELECTION; | 294 action = content::STOP_FIND_ACTION_ACTIVATE_SELECTION; |
| 294 break; | 295 break; |
| 295 default: | 296 default: |
| 296 action = content::STOP_FIND_ACTION_KEEP_SELECTION; | 297 action = content::STOP_FIND_ACTION_KEEP_SELECTION; |
| 297 } | 298 } |
| 298 | 299 |
| 299 guest->StopFinding(action); | 300 guest->StopFinding(action); |
| 300 return true; | 301 return true; |
| 301 } | 302 } |
| 302 | 303 |
| 304 WebViewInternalLoadDataWithBaseUrlFunction:: |
| 305 WebViewInternalLoadDataWithBaseUrlFunction() { |
| 306 } |
| 307 |
| 308 WebViewInternalLoadDataWithBaseUrlFunction:: |
| 309 ~WebViewInternalLoadDataWithBaseUrlFunction() { |
| 310 } |
| 311 |
| 312 bool WebViewInternalLoadDataWithBaseUrlFunction::RunAsyncSafe( |
| 313 WebViewGuest* guest) { |
| 314 scoped_ptr<webview::LoadDataWithBaseUrl::Params> params( |
| 315 webview::LoadDataWithBaseUrl::Params::Create(*args_)); |
| 316 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 317 |
| 318 // If a virtual URL was provided, use it. Otherwise, the user will be shown |
| 319 // the data URL. |
| 320 std::string virtual_url = |
| 321 params->virtual_url ? *params->virtual_url : params->data_url; |
| 322 |
| 323 bool successful = guest->LoadDataWithBaseURL( |
| 324 params->data_url, params->base_url, virtual_url, &error_); |
| 325 SendResponse(successful); |
| 326 return successful; |
| 327 } |
| 328 |
| 303 WebViewInternalGoFunction::WebViewInternalGoFunction() { | 329 WebViewInternalGoFunction::WebViewInternalGoFunction() { |
| 304 } | 330 } |
| 305 | 331 |
| 306 WebViewInternalGoFunction::~WebViewInternalGoFunction() { | 332 WebViewInternalGoFunction::~WebViewInternalGoFunction() { |
| 307 } | 333 } |
| 308 | 334 |
| 309 bool WebViewInternalGoFunction::RunAsyncSafe(WebViewGuest* guest) { | 335 bool WebViewInternalGoFunction::RunAsyncSafe(WebViewGuest* guest) { |
| 310 scoped_ptr<webview::Go::Params> params(webview::Go::Params::Create(*args_)); | 336 scoped_ptr<webview::Go::Params> params(webview::Go::Params::Create(*args_)); |
| 311 EXTENSION_FUNCTION_VALIDATE(params.get()); | 337 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 312 | 338 |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 // Will finish asynchronously. | 513 // Will finish asynchronously. |
| 488 return true; | 514 return true; |
| 489 } | 515 } |
| 490 | 516 |
| 491 void WebViewInternalClearDataFunction::ClearDataDone() { | 517 void WebViewInternalClearDataFunction::ClearDataDone() { |
| 492 Release(); // Balanced in RunAsync(). | 518 Release(); // Balanced in RunAsync(). |
| 493 SendResponse(true); | 519 SendResponse(true); |
| 494 } | 520 } |
| 495 | 521 |
| 496 } // namespace extensions | 522 } // namespace extensions |
| OLD | NEW |