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

Side by Side Diff: chrome/browser/ui/android/chrome_http_auth_handler.h

Issue 1466473003: Do not show untrustworthy strings in the basic auth dialog. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix XIB. Created 5 years 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_UI_ANDROID_CHROME_HTTP_AUTH_HANDLER_H_ 5 #ifndef CHROME_BROWSER_UI_ANDROID_CHROME_HTTP_AUTH_HANDLER_H_
6 #define CHROME_BROWSER_UI_ANDROID_CHROME_HTTP_AUTH_HANDLER_H_ 6 #define CHROME_BROWSER_UI_ANDROID_CHROME_HTTP_AUTH_HANDLER_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 9
10 #include "base/android/scoped_java_ref.h" 10 #include "base/android/scoped_java_ref.h"
11 #include "base/strings/string16.h" 11 #include "base/strings/string16.h"
12 #include "chrome/browser/ui/login/login_prompt.h" 12 #include "chrome/browser/ui/login/login_prompt.h"
13 13
14 // This class facilitates communication between a native LoginHandler 14 // This class facilitates communication between a native LoginHandler
15 // and a Java land ChromeHttpAuthHandler, which is passed to a 15 // and a Java land ChromeHttpAuthHandler, which is passed to a
16 // ContentViewClient to allow it to respond to HTTP authentication requests 16 // ContentViewClient to allow it to respond to HTTP authentication requests
17 // by, e.g., showing the user a login dialog. 17 // by, e.g., showing the user a login dialog.
18 class ChromeHttpAuthHandler { 18 class ChromeHttpAuthHandler {
19 public: 19 public:
20 explicit ChromeHttpAuthHandler(const base::string16& explanation); 20 ChromeHttpAuthHandler(const base::string16& authority,
21 const base::string16& explanation);
21 ~ChromeHttpAuthHandler(); 22 ~ChromeHttpAuthHandler();
22 23
23 // This must be called before using the object. 24 // This must be called before using the object.
24 // Constructs a corresponding Java land ChromeHttpAuthHandler. 25 // Constructs a corresponding Java land ChromeHttpAuthHandler.
25 void Init(); 26 void Init();
26 27
27 // Registers an observer to receive callbacks when SetAuth() and CancelAuth() 28 // Registers an observer to receive callbacks when SetAuth() and CancelAuth()
28 // are called. |observer| may be NULL in which case the callbacks are skipped. 29 // are called. |observer| may be NULL in which case the callbacks are skipped.
29 void SetObserver(LoginHandler* observer); 30 void SetObserver(LoginHandler* observer);
30 31
(...skipping 20 matching lines...) Expand all
51 52
52 // These functions return the strings needed to display a login form. 53 // These functions return the strings needed to display a login form.
53 base::android::ScopedJavaLocalRef<jstring> GetMessageBody( 54 base::android::ScopedJavaLocalRef<jstring> GetMessageBody(
54 JNIEnv* env, 55 JNIEnv* env,
55 const base::android::JavaParamRef<jobject>&); 56 const base::android::JavaParamRef<jobject>&);
56 // Registers the ChromeHttpAuthHandler native methods. 57 // Registers the ChromeHttpAuthHandler native methods.
57 static bool RegisterChromeHttpAuthHandler(JNIEnv* env); 58 static bool RegisterChromeHttpAuthHandler(JNIEnv* env);
58 private: 59 private:
59 LoginHandler* observer_; 60 LoginHandler* observer_;
60 base::android::ScopedJavaGlobalRef<jobject> java_chrome_http_auth_handler_; 61 base::android::ScopedJavaGlobalRef<jobject> java_chrome_http_auth_handler_;
61 // e.g. "The server example.com:80 requires a username and password." 62 base::string16 authority_;
62 base::string16 explanation_; 63 base::string16 explanation_;
63 64
64 DISALLOW_COPY_AND_ASSIGN(ChromeHttpAuthHandler); 65 DISALLOW_COPY_AND_ASSIGN(ChromeHttpAuthHandler);
65 }; 66 };
66 67
67 #endif // CHROME_BROWSER_UI_ANDROID_CHROME_HTTP_AUTH_HANDLER_H_ 68 #endif // CHROME_BROWSER_UI_ANDROID_CHROME_HTTP_AUTH_HANDLER_H_
OLDNEW
« no previous file with comments | « chrome/app/nibs/HttpAuthLoginSheet.xib ('k') | chrome/browser/ui/android/chrome_http_auth_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698