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/guest_view/web_view/javascript_dialog_helper.h" | 5 #include "extensions/browser/guest_view/web_view/javascript_dialog_helper.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "components/guest_view/common/guest_view_constants.h" | 9 #include "components/guest_view/common/guest_view_constants.h" |
10 #include "extensions/browser/guest_view/web_view/web_view_constants.h" | 10 #include "extensions/browser/guest_view/web_view/web_view_constants.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 JavaScriptDialogHelper::JavaScriptDialogHelper(WebViewGuest* guest) | 36 JavaScriptDialogHelper::JavaScriptDialogHelper(WebViewGuest* guest) |
37 : web_view_guest_(guest) { | 37 : web_view_guest_(guest) { |
38 } | 38 } |
39 | 39 |
40 JavaScriptDialogHelper::~JavaScriptDialogHelper() { | 40 JavaScriptDialogHelper::~JavaScriptDialogHelper() { |
41 } | 41 } |
42 | 42 |
43 void JavaScriptDialogHelper::RunJavaScriptDialog( | 43 void JavaScriptDialogHelper::RunJavaScriptDialog( |
44 content::WebContents* web_contents, | 44 content::WebContents* web_contents, |
45 const GURL& origin_url, | 45 const GURL& origin_url, |
46 const std::string& accept_lang, | |
47 content::JavaScriptMessageType javascript_message_type, | 46 content::JavaScriptMessageType javascript_message_type, |
48 const base::string16& message_text, | 47 const base::string16& message_text, |
49 const base::string16& default_prompt_text, | 48 const base::string16& default_prompt_text, |
50 const DialogClosedCallback& callback, | 49 const DialogClosedCallback& callback, |
51 bool* did_suppress_message) { | 50 bool* did_suppress_message) { |
52 base::DictionaryValue request_info; | 51 base::DictionaryValue request_info; |
53 request_info.Set( | 52 request_info.Set( |
54 webview::kDefaultPromptText, | 53 webview::kDefaultPromptText, |
55 new base::StringValue(base::UTF16ToUTF8(default_prompt_text))); | 54 new base::StringValue(base::UTF16ToUTF8(default_prompt_text))); |
56 request_info.Set(webview::kMessageText, | 55 request_info.Set(webview::kMessageText, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 | 95 |
97 void JavaScriptDialogHelper::OnPermissionResponse( | 96 void JavaScriptDialogHelper::OnPermissionResponse( |
98 const DialogClosedCallback& callback, | 97 const DialogClosedCallback& callback, |
99 bool allow, | 98 bool allow, |
100 const std::string& user_input) { | 99 const std::string& user_input) { |
101 callback.Run(allow && web_view_guest_->attached(), | 100 callback.Run(allow && web_view_guest_->attached(), |
102 base::UTF8ToUTF16(user_input)); | 101 base::UTF8ToUTF16(user_input)); |
103 } | 102 } |
104 | 103 |
105 } // namespace extensions | 104 } // namespace extensions |
OLD | NEW |