| 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 "chrome/browser/extensions/tab_helper.h" | 7 #include "chrome/browser/extensions/tab_helper.h" |
| 8 #include "chrome/browser/webview/webview_guest.h" | 8 #include "chrome/browser/webview/webview_guest.h" |
| 9 #include "chrome/common/extensions/api/webview.h" | 9 #include "chrome/common/extensions/api/webview.h" |
| 10 #include "content/public/browser/render_process_host.h" | 10 #include "content/public/browser/render_process_host.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 bool WebviewExecuteCodeFunction::Init() { | 25 bool WebviewExecuteCodeFunction::Init() { |
| 26 if (details_.get()) | 26 if (details_.get()) |
| 27 return true; | 27 return true; |
| 28 | 28 |
| 29 if (!args_->GetInteger(0, &guest_instance_id_)) | 29 if (!args_->GetInteger(0, &guest_instance_id_)) |
| 30 return false; | 30 return false; |
| 31 | 31 |
| 32 if (!guest_instance_id_) | 32 if (!guest_instance_id_) |
| 33 return false; | 33 return false; |
| 34 | 34 |
| 35 DictionaryValue* details_value = NULL; | 35 base::DictionaryValue* details_value = NULL; |
| 36 if (!args_->GetDictionary(1, &details_value)) | 36 if (!args_->GetDictionary(1, &details_value)) |
| 37 return false; | 37 return false; |
| 38 scoped_ptr<InjectDetails> details(new InjectDetails()); | 38 scoped_ptr<InjectDetails> details(new InjectDetails()); |
| 39 if (!InjectDetails::Populate(*details_value, details.get())) | 39 if (!InjectDetails::Populate(*details_value, details.get())) |
| 40 return false; | 40 return false; |
| 41 | 41 |
| 42 details_ = details.Pass(); | 42 details_ = details.Pass(); |
| 43 return true; | 43 return true; |
| 44 } | 44 } |
| 45 | 45 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 61 } | 61 } |
| 62 | 62 |
| 63 bool WebviewExecuteCodeFunction::IsWebView() const { | 63 bool WebviewExecuteCodeFunction::IsWebView() const { |
| 64 return true; | 64 return true; |
| 65 } | 65 } |
| 66 | 66 |
| 67 void WebviewExecuteScriptFunction::OnExecuteCodeFinished( | 67 void WebviewExecuteScriptFunction::OnExecuteCodeFinished( |
| 68 const std::string& error, | 68 const std::string& error, |
| 69 int32 on_page_id, | 69 int32 on_page_id, |
| 70 const GURL& on_url, | 70 const GURL& on_url, |
| 71 const ListValue& result) { | 71 const base::ListValue& result) { |
| 72 content::RecordAction(content::UserMetricsAction("WebView.ExecuteScript")); | 72 content::RecordAction(content::UserMetricsAction("WebView.ExecuteScript")); |
| 73 if (error.empty()) | 73 if (error.empty()) |
| 74 SetResult(result.DeepCopy()); | 74 SetResult(result.DeepCopy()); |
| 75 WebviewExecuteCodeFunction::OnExecuteCodeFinished(error, on_page_id, on_url, | 75 WebviewExecuteCodeFunction::OnExecuteCodeFinished(error, on_page_id, on_url, |
| 76 result); | 76 result); |
| 77 } | 77 } |
| 78 | 78 |
| 79 bool WebviewInsertCSSFunction::ShouldInsertCSS() const { | 79 bool WebviewInsertCSSFunction::ShouldInsertCSS() const { |
| 80 return true; | 80 return true; |
| 81 } | 81 } |
| 82 | 82 |
| OLD | NEW |