OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/ui/android/bluetooth_chooser_android.h" | 5 #include "chrome/browser/ui/android/bluetooth_chooser_android.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/ssl/security_state_tab_helper.h" | 10 #include "chrome/browser/ssl/security_state_tab_helper.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 using base::android::ConvertUTF16ToJavaString; | 22 using base::android::ConvertUTF16ToJavaString; |
23 using base::android::JavaParamRef; | 23 using base::android::JavaParamRef; |
24 using base::android::ScopedJavaLocalRef; | 24 using base::android::ScopedJavaLocalRef; |
25 | 25 |
26 BluetoothChooserAndroid::BluetoothChooserAndroid( | 26 BluetoothChooserAndroid::BluetoothChooserAndroid( |
27 content::RenderFrameHost* frame, | 27 content::RenderFrameHost* frame, |
28 const EventHandler& event_handler) | 28 const EventHandler& event_handler) |
29 : web_contents_(content::WebContents::FromRenderFrameHost(frame)), | 29 : web_contents_(content::WebContents::FromRenderFrameHost(frame)), |
30 event_handler_(event_handler) { | 30 event_handler_(event_handler) { |
31 const url::Origin origin = frame->GetLastCommittedOrigin(); | 31 const url::Origin origin = frame->GetLastCommittedOrigin(); |
32 DCHECK(!origin.unique()); | 32 DCHECK(!origin.opaque()); |
33 | 33 |
34 base::android::ScopedJavaLocalRef<jobject> window_android = | 34 base::android::ScopedJavaLocalRef<jobject> window_android = |
35 web_contents_->GetNativeView()->GetWindowAndroid()->GetJavaObject(); | 35 web_contents_->GetNativeView()->GetWindowAndroid()->GetJavaObject(); |
36 | 36 |
37 SecurityStateTabHelper* helper = | 37 SecurityStateTabHelper* helper = |
38 SecurityStateTabHelper::FromWebContents(web_contents_); | 38 SecurityStateTabHelper::FromWebContents(web_contents_); |
39 DCHECK(helper); | 39 DCHECK(helper); |
40 | 40 |
41 // Create (and show) the BluetoothChooser dialog. | 41 // Create (and show) the BluetoothChooser dialog. |
42 JNIEnv* env = AttachCurrentThread(); | 42 JNIEnv* env = AttachCurrentThread(); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 const JavaParamRef<jobject>& obj) { | 157 const JavaParamRef<jobject>& obj) { |
158 OpenURL(chrome::kChooserBluetoothOverviewURL); | 158 OpenURL(chrome::kChooserBluetoothOverviewURL); |
159 event_handler_.Run(Event::SHOW_NEED_LOCATION_HELP, ""); | 159 event_handler_.Run(Event::SHOW_NEED_LOCATION_HELP, ""); |
160 } | 160 } |
161 | 161 |
162 void BluetoothChooserAndroid::OpenURL(const char* url) { | 162 void BluetoothChooserAndroid::OpenURL(const char* url) { |
163 web_contents_->OpenURL(content::OpenURLParams( | 163 web_contents_->OpenURL(content::OpenURLParams( |
164 GURL(url), content::Referrer(), WindowOpenDisposition::NEW_FOREGROUND_TAB, | 164 GURL(url), content::Referrer(), WindowOpenDisposition::NEW_FOREGROUND_TAB, |
165 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, false /* is_renderer_initiated */)); | 165 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, false /* is_renderer_initiated */)); |
166 } | 166 } |
OLD | NEW |