Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1514)

Side by Side Diff: chrome/browser/ui/android/bluetooth_chooser_android.cc

Issue 1314843007: Refactor connection_security into SecurityStateModel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: create SecurityStateModel for chromeos login webview Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/connection_security.h" 10 #include "chrome/browser/ssl/security_state_model.h"
11 #include "chrome/browser/ui/android/window_android_helper.h" 11 #include "chrome/browser/ui/android/window_android_helper.h"
12 #include "content/public/browser/android/content_view_core.h" 12 #include "content/public/browser/android/content_view_core.h"
13 #include "jni/BluetoothChooserDialog_jni.h" 13 #include "jni/BluetoothChooserDialog_jni.h"
14 #include "ui/android/window_android.h" 14 #include "ui/android/window_android.h"
15 15
16 using base::android::AttachCurrentThread; 16 using base::android::AttachCurrentThread;
17 using base::android::ConvertUTF8ToJavaString; 17 using base::android::ConvertUTF8ToJavaString;
18 using base::android::ConvertUTF16ToJavaString; 18 using base::android::ConvertUTF16ToJavaString;
19 using base::android::ScopedJavaLocalRef; 19 using base::android::ScopedJavaLocalRef;
20 20
21 BluetoothChooserAndroid::BluetoothChooserAndroid( 21 BluetoothChooserAndroid::BluetoothChooserAndroid(
22 content::WebContents* web_contents, 22 content::WebContents* web_contents,
23 const EventHandler& event_handler, 23 const EventHandler& event_handler,
24 const GURL& origin) 24 const GURL& origin)
25 : event_handler_(event_handler) { 25 : event_handler_(event_handler) {
26 base::android::ScopedJavaLocalRef<jobject> window_android = 26 base::android::ScopedJavaLocalRef<jobject> window_android =
27 content::ContentViewCore::FromWebContents( 27 content::ContentViewCore::FromWebContents(
28 web_contents)->GetWindowAndroid()->GetJavaObject(); 28 web_contents)->GetWindowAndroid()->GetJavaObject();
29 29
30 SecurityStateModel* security_model =
31 SecurityStateModel::FromWebContents(web_contents);
32 DCHECK(security_model);
33
30 // Create (and show) the BluetoothChooser dialog. 34 // Create (and show) the BluetoothChooser dialog.
31 JNIEnv* env = AttachCurrentThread(); 35 JNIEnv* env = AttachCurrentThread();
32 ScopedJavaLocalRef<jstring> origin_string = 36 ScopedJavaLocalRef<jstring> origin_string =
33 ConvertUTF8ToJavaString(env, origin.spec()); 37 ConvertUTF8ToJavaString(env, origin.spec());
34 java_dialog_.Reset(Java_BluetoothChooserDialog_create( 38 java_dialog_.Reset(Java_BluetoothChooserDialog_create(
35 env, window_android.obj(), origin_string.obj(), 39 env, window_android.obj(), origin_string.obj(),
36 connection_security::GetSecurityLevelForWebContents(web_contents), 40 security_model->security_info().security_level,
37 reinterpret_cast<intptr_t>(this))); 41 reinterpret_cast<intptr_t>(this)));
38 } 42 }
39 43
40 BluetoothChooserAndroid::~BluetoothChooserAndroid() { 44 BluetoothChooserAndroid::~BluetoothChooserAndroid() {
41 Java_BluetoothChooserDialog_closeDialog(AttachCurrentThread(), 45 Java_BluetoothChooserDialog_closeDialog(AttachCurrentThread(),
42 java_dialog_.obj()); 46 java_dialog_.obj());
43 } 47 }
44 48
45 void BluetoothChooserAndroid::SetAdapterPresence(AdapterPresence presence) { 49 void BluetoothChooserAndroid::SetAdapterPresence(AdapterPresence presence) {
46 if (presence != AdapterPresence::POWERED_ON) { 50 if (presence != AdapterPresence::POWERED_ON) {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 103
100 void BluetoothChooserAndroid::ShowBluetoothAdapterOffLink(JNIEnv* env, 104 void BluetoothChooserAndroid::ShowBluetoothAdapterOffLink(JNIEnv* env,
101 jobject obj) { 105 jobject obj) {
102 event_handler_.Run(Event::SHOW_ADAPTER_OFF_HELP, ""); 106 event_handler_.Run(Event::SHOW_ADAPTER_OFF_HELP, "");
103 } 107 }
104 108
105 // static 109 // static
106 bool BluetoothChooserAndroid::Register(JNIEnv* env) { 110 bool BluetoothChooserAndroid::Register(JNIEnv* env) {
107 return RegisterNativesImpl(env); 111 return RegisterNativesImpl(env);
108 } 112 }
OLDNEW
« no previous file with comments | « chrome/browser/ssl/ssl_browser_tests.cc ('k') | chrome/browser/ui/android/toolbar/toolbar_model_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698