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

Side by Side Diff: chrome/browser/chrome_content_browser_client.cc

Issue 11266008: Fix certificate and keychain installation on Android. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 1 month 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 #include "chrome/browser/chrome_content_browser_client.h" 5 #include "chrome/browser/chrome_content_browser_client.h"
6 6
7 #include <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 #include "content/public/browser/render_view_host.h" 93 #include "content/public/browser/render_view_host.h"
94 #include "content/public/browser/resource_context.h" 94 #include "content/public/browser/resource_context.h"
95 #include "content/public/browser/site_instance.h" 95 #include "content/public/browser/site_instance.h"
96 #include "content/public/browser/web_contents.h" 96 #include "content/public/browser/web_contents.h"
97 #include "content/public/browser/web_contents_view.h" 97 #include "content/public/browser/web_contents_view.h"
98 #include "content/public/common/child_process_host.h" 98 #include "content/public/common/child_process_host.h"
99 #include "content/public/common/compositor_util.h" 99 #include "content/public/common/compositor_util.h"
100 #include "content/public/common/content_descriptors.h" 100 #include "content/public/common/content_descriptors.h"
101 #include "grit/generated_resources.h" 101 #include "grit/generated_resources.h"
102 #include "grit/ui_resources.h" 102 #include "grit/ui_resources.h"
103 #include "net/base/mime_util.h"
103 #include "net/base/ssl_cert_request_info.h" 104 #include "net/base/ssl_cert_request_info.h"
104 #include "net/cookies/canonical_cookie.h" 105 #include "net/cookies/canonical_cookie.h"
105 #include "net/cookies/cookie_options.h" 106 #include "net/cookies/cookie_options.h"
106 #include "ppapi/host/ppapi_host.h" 107 #include "ppapi/host/ppapi_host.h"
107 #include "ui/base/l10n/l10n_util.h" 108 #include "ui/base/l10n/l10n_util.h"
108 #include "ui/base/resource/resource_bundle.h" 109 #include "ui/base/resource/resource_bundle.h"
109 #include "webkit/glue/webpreferences.h" 110 #include "webkit/glue/webpreferences.h"
110 #include "webkit/plugins/plugin_switches.h" 111 #include "webkit/plugins/plugin_switches.h"
111 112
112 #if defined(OS_WIN) 113 #if defined(OS_WIN)
113 #include "chrome/browser/chrome_browser_main_win.h" 114 #include "chrome/browser/chrome_browser_main_win.h"
114 #elif defined(OS_MACOSX) 115 #elif defined(OS_MACOSX)
115 #include "chrome/browser/chrome_browser_main_mac.h" 116 #include "chrome/browser/chrome_browser_main_mac.h"
116 #include "chrome/browser/spellchecker/spellcheck_message_filter_mac.h" 117 #include "chrome/browser/spellchecker/spellcheck_message_filter_mac.h"
117 #elif defined(OS_CHROMEOS) 118 #elif defined(OS_CHROMEOS)
118 #include "chrome/browser/chromeos/chrome_browser_main_chromeos.h" 119 #include "chrome/browser/chromeos/chrome_browser_main_chromeos.h"
119 #include "chrome/browser/chromeos/login/user_manager.h" 120 #include "chrome/browser/chromeos/login/user_manager.h"
120 #elif defined(OS_LINUX) 121 #elif defined(OS_LINUX)
121 #include "chrome/browser/chrome_browser_main_linux.h" 122 #include "chrome/browser/chrome_browser_main_linux.h"
122 #elif defined(OS_ANDROID) 123 #elif defined(OS_ANDROID)
123 #include "chrome/browser/chrome_browser_main_android.h" 124 #include "chrome/browser/chrome_browser_main_android.h"
124 #include "chrome/common/descriptors_android.h" 125 #include "chrome/common/descriptors_android.h"
126 #include "net/android/network_library.h"
125 #elif defined(OS_POSIX) 127 #elif defined(OS_POSIX)
126 #include "chrome/browser/chrome_browser_main_posix.h" 128 #include "chrome/browser/chrome_browser_main_posix.h"
127 #endif 129 #endif
128 130
129 #if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(OS_ANDROID) 131 #if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(OS_ANDROID)
130 #include "base/linux_util.h" 132 #include "base/linux_util.h"
131 #include "chrome/browser/crash_handler_host_linux.h" 133 #include "chrome/browser/crash_handler_host_linux.h"
132 #endif 134 #endif
133 135
134 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) 136 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION)
(...skipping 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after
1267 // If there is no SSLTabHelper for the given WebContents then we can't 1269 // If there is no SSLTabHelper for the given WebContents then we can't
1268 // show the user a dialog to select a client certificate. So we simply 1270 // show the user a dialog to select a client certificate. So we simply
1269 // proceed with no client certificate. 1271 // proceed with no client certificate.
1270 callback.Run(NULL); 1272 callback.Run(NULL);
1271 return; 1273 return;
1272 } 1274 }
1273 ssl_tab_helper->ShowClientCertificateRequestDialog( 1275 ssl_tab_helper->ShowClientCertificateRequestDialog(
1274 network_session, cert_request_info, callback); 1276 network_session, cert_request_info, callback);
1275 } 1277 }
1276 1278
1277 void ChromeContentBrowserClient::AddNewCertificate( 1279 void ChromeContentBrowserClient::AddCertificates(
1278 net::URLRequest* request, 1280 net::URLRequest* request,
1279 net::X509Certificate* cert, 1281 net::CertificateType cert_type,
1282 const void* cert_data,
1283 size_t cert_size,
1280 int render_process_id, 1284 int render_process_id,
1281 int render_view_id) { 1285 int render_view_id) {
1282 // The handler will run the UI and delete itself when it's finished. 1286 #ifdef OS_ANDROID
Ryan Sleevi 2012/11/13 19:37:50 nit: #if defined(OS_ANDROID)
digit1 2012/11/15 17:42:14 Done.
1283 new SSLAddCertHandler(request, cert, render_process_id, render_view_id); 1287 // Special case for Android here for several reasons:
1288 //
1289 // - The SSLAddCertHandler implementation currently only supports
1290 // CERTIFICATE_TYPE_X509_USER_CERT, but not other types, like
1291 // CERTIFICATE_TYPE_PKCS12_KEYCHAIN which are required on this
1292 // platform.
1293 //
1294 // - Besides, SSLAddCertHandler tries to parse the certificate
1295 // by calling net::CertDatabase::CheckUserCert() which is not
1296 // implemented on Android, mainly because there is no API
1297 // provided by the system to do that properly.
1298 //
1299 // - The Android CertInstaller activity will check the crypto files
Ryan Sleevi 2012/11/13 19:37:50 nit: "crypto files"
digit1 2012/11/15 17:42:14 Done.
1300 // and display a toast (small fading dialog) to the user if it is
1301 // not valid, so the UI stuff performed by SSLAddCertHandler would
Ryan Sleevi 2012/11/13 19:37:50 nit: s/stuff//
digit1 2012/11/15 17:42:14 Done.
1302 // be redundant.
1303 if (cert_size > 0) {
1304 // This launches a new activity which will run in a different process.
1305 // It handles all user interaction, so no need to do anything in the
1306 // browser UI thread here.
1307 net::android::StoreCertificate(cert_type, cert_data, cert_size);
1308 }
1309 // Avoid compiler warnings.
1310 (void)render_process_id;
1311 (void)render_view_id;
Ryan Sleevi 2012/11/13 19:37:50 I believe we have an ALLOW_UNUSED macro for this.
digit1 2012/11/15 17:42:14 I believe it only works for local variable declara
1312 #else
1313 // Chromium only supports X509 User certificates on other platforms.
1314 // Note that this method should not be called for other certificate
1315 // types. See net::GetCertificateTypeFromMimeType().
1316 if (cert_type == net::CERTIFICATE_TYPE_X509_USER_CERT) {
1317 scoped_refptr<net::X509Certificate> cert;
1318 if (cert_data != NULL) {
1319 cert = net::X509Certificate::CreateFromBytes(
1320 reinterpret_cast<const char*>(cert_data), cert_size);
1321 }
1322 // NOTE: Passing a NULL cert pointer if |cert_data| was NULL is
1323 // intentional here.
1324
1325 // The handler will run the UI and delete itself when it's finished.
1326 new SSLAddCertHandler(request, cert, render_process_id, render_view_id);
1327 }
1328 #endif
1284 } 1329 }
1285 1330
1286 content::MediaObserver* ChromeContentBrowserClient::GetMediaObserver() { 1331 content::MediaObserver* ChromeContentBrowserClient::GetMediaObserver() {
1287 return MediaInternals::GetInstance(); 1332 return MediaInternals::GetInstance();
1288 } 1333 }
1289 1334
1290 void ChromeContentBrowserClient::RequestDesktopNotificationPermission( 1335 void ChromeContentBrowserClient::RequestDesktopNotificationPermission(
1291 const GURL& source_origin, 1336 const GURL& source_origin,
1292 int callback_context, 1337 int callback_context,
1293 int render_process_id, 1338 int render_process_id,
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
1849 partition_id = extension->id(); 1894 partition_id = extension->id();
1850 } 1895 }
1851 1896
1852 // Enforce that IsValidStoragePartitionId() implementation stays in sync. 1897 // Enforce that IsValidStoragePartitionId() implementation stays in sync.
1853 DCHECK(IsValidStoragePartitionId(browser_context, partition_id)); 1898 DCHECK(IsValidStoragePartitionId(browser_context, partition_id));
1854 return partition_id; 1899 return partition_id;
1855 } 1900 }
1856 1901
1857 1902
1858 } // namespace chrome 1903 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698