| 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/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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &instance_id)); | 253 EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &instance_id)); |
| 254 WebViewGuest* guest = WebViewGuest::From( | 254 WebViewGuest* guest = WebViewGuest::From( |
| 255 render_frame_host()->GetProcess()->GetID(), instance_id); | 255 render_frame_host()->GetProcess()->GetID(), instance_id); |
| 256 if (!guest) | 256 if (!guest) |
| 257 return false; | 257 return false; |
| 258 | 258 |
| 259 return RunAsyncSafe(guest); | 259 return RunAsyncSafe(guest); |
| 260 } | 260 } |
| 261 | 261 |
| 262 bool WebViewInternalExtensionFunction::PreRunValidation(std::string* error) { | 262 bool WebViewInternalExtensionFunction::PreRunValidation(std::string* error) { |
| 263 if (!UIThreadExtensionFunction::PreRunValidation(error)) |
| 264 return false; |
| 265 |
| 263 int instance_id = 0; | 266 int instance_id = 0; |
| 264 EXTENSION_FUNCTION_PRERUN_VALIDATE(args_->GetInteger(0, &instance_id)); | 267 EXTENSION_FUNCTION_PRERUN_VALIDATE(args_->GetInteger(0, &instance_id)); |
| 265 guest_ = WebViewGuest::From(render_frame_host()->GetProcess()->GetID(), | 268 guest_ = WebViewGuest::From(render_frame_host()->GetProcess()->GetID(), |
| 266 instance_id); | 269 instance_id); |
| 267 if (!guest_) { | 270 if (!guest_) { |
| 268 *error = "Could not find guest"; | 271 *error = "Could not find guest"; |
| 269 return false; | 272 return false; |
| 270 } | 273 } |
| 271 return true; | 274 return true; |
| 272 } | 275 } |
| (...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 962 // Will finish asynchronously. | 965 // Will finish asynchronously. |
| 963 return true; | 966 return true; |
| 964 } | 967 } |
| 965 | 968 |
| 966 void WebViewInternalClearDataFunction::ClearDataDone() { | 969 void WebViewInternalClearDataFunction::ClearDataDone() { |
| 967 Release(); // Balanced in RunAsync(). | 970 Release(); // Balanced in RunAsync(). |
| 968 SendResponse(true); | 971 SendResponse(true); |
| 969 } | 972 } |
| 970 | 973 |
| 971 } // namespace extensions | 974 } // namespace extensions |
| OLD | NEW |