Chromium Code Reviews| 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/stringprintf.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "content/public/browser/render_process_host.h" | 9 #include "content/public/browser/render_process_host.h" |
| 10 #include "content/public/browser/render_view_host.h" | 10 #include "content/public/browser/render_view_host.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 95 return false; | 95 return false; |
| 96 | 96 |
| 97 base::DictionaryValue* details_value = NULL; | 97 base::DictionaryValue* details_value = NULL; |
| 98 if (!args_->GetDictionary(2, &details_value)) | 98 if (!args_->GetDictionary(2, &details_value)) |
| 99 return false; | 99 return false; |
| 100 scoped_ptr<InjectDetails> details(new InjectDetails()); | 100 scoped_ptr<InjectDetails> details(new InjectDetails()); |
| 101 if (!InjectDetails::Populate(*details_value, details.get())) | 101 if (!InjectDetails::Populate(*details_value, details.get())) |
| 102 return false; | 102 return false; |
| 103 | 103 |
| 104 details_ = details.Pass(); | 104 details_ = details.Pass(); |
| 105 return true; | 105 |
| 106 if (extension()) { | |
| 107 set_host_id(HostID(HostID::EXTENSIONS, extension()->id())); | |
| 108 return true; | |
| 109 } | |
| 110 | |
| 111 const content::RenderViewHost* rvh = render_view_host(); | |
|
Devlin
2015/02/27 17:11:36
This can actually be simplified to:
content::WebCo
Xi Han
2015/02/27 21:07:46
Done.
| |
| 112 if (rvh) { | |
| 113 WebContents* web_contents = WebContents::FromRenderViewHost(rvh); | |
| 114 if (web_contents && web_contents->GetWebUI()) { | |
| 115 const GURL& url = rvh->GetSiteInstance()->GetSiteURL(); | |
| 116 set_host_id(HostID(HostID::WEBUI, url.spec())); | |
| 117 return true; | |
| 118 } | |
| 119 } | |
| 120 return false; | |
| 106 } | 121 } |
| 107 | 122 |
| 108 bool WebViewInternalExecuteCodeFunction::ShouldInsertCSS() const { | 123 bool WebViewInternalExecuteCodeFunction::ShouldInsertCSS() const { |
| 109 return false; | 124 return false; |
| 110 } | 125 } |
| 111 | 126 |
| 112 bool WebViewInternalExecuteCodeFunction::CanExecuteScriptOnPage() { | 127 bool WebViewInternalExecuteCodeFunction::CanExecuteScriptOnPage() { |
| 113 return true; | 128 return true; |
| 114 } | 129 } |
| 115 | 130 |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 510 // Will finish asynchronously. | 525 // Will finish asynchronously. |
| 511 return true; | 526 return true; |
| 512 } | 527 } |
| 513 | 528 |
| 514 void WebViewInternalClearDataFunction::ClearDataDone() { | 529 void WebViewInternalClearDataFunction::ClearDataDone() { |
| 515 Release(); // Balanced in RunAsync(). | 530 Release(); // Balanced in RunAsync(). |
| 516 SendResponse(true); | 531 SendResponse(true); |
| 517 } | 532 } |
| 518 | 533 |
| 519 } // namespace extensions | 534 } // namespace extensions |
| OLD | NEW |