| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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> |
| 8 #include <vector> |
| 9 |
| 7 #include "base/bind.h" | 10 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 9 #include "chrome/app/breakpad_mac.h" | 12 #include "chrome/app/breakpad_mac.h" |
| 10 #include "chrome/browser/browser_about_handler.h" | 13 #include "chrome/browser/browser_about_handler.h" |
| 11 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
| 12 #include "chrome/browser/browsing_data_remover.h" | 15 #include "chrome/browser/browsing_data_remover.h" |
| 13 #include "chrome/browser/character_encoding.h" | 16 #include "chrome/browser/character_encoding.h" |
| 14 #include "chrome/browser/chrome_benchmarking_message_filter.h" | 17 #include "chrome/browser/chrome_benchmarking_message_filter.h" |
| 15 #include "chrome/browser/chrome_plugin_message_filter.h" | 18 #include "chrome/browser/chrome_plugin_message_filter.h" |
| 16 #include "chrome/browser/chrome_quota_permission_context.h" | 19 #include "chrome/browser/chrome_quota_permission_context.h" |
| (...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 std::string ChromeContentBrowserClient::GetApplicationLocale() { | 640 std::string ChromeContentBrowserClient::GetApplicationLocale() { |
| 638 return g_browser_process->GetApplicationLocale(); | 641 return g_browser_process->GetApplicationLocale(); |
| 639 } | 642 } |
| 640 | 643 |
| 641 std::string ChromeContentBrowserClient::GetAcceptLangs(const TabContents* tab) { | 644 std::string ChromeContentBrowserClient::GetAcceptLangs(const TabContents* tab) { |
| 642 Profile* profile = Profile::FromBrowserContext(tab->browser_context()); | 645 Profile* profile = Profile::FromBrowserContext(tab->browser_context()); |
| 643 return profile->GetPrefs()->GetString(prefs::kAcceptLanguages); | 646 return profile->GetPrefs()->GetString(prefs::kAcceptLanguages); |
| 644 } | 647 } |
| 645 | 648 |
| 646 SkBitmap* ChromeContentBrowserClient::GetDefaultFavicon() { | 649 SkBitmap* ChromeContentBrowserClient::GetDefaultFavicon() { |
| 647 ResourceBundle &rb = ResourceBundle::GetSharedInstance(); | 650 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 648 #if defined(TOUCH_UI) | 651 #if defined(TOUCH_UI) |
| 649 // In touch builds, we want large default favicons for the tabstrip, but in | 652 // In touch builds, we want large default favicons for the tabstrip, but in |
| 650 // other places (such as bookmark, manage search engines, homepage) we assume | 653 // other places (such as bookmark, manage search engines, homepage) we assume |
| 651 // default favicons are 16x16. | 654 // default favicons are 16x16. |
| 652 return rb.GetBitmapNamed(IDR_DEFAULT_LARGE_FAVICON); | 655 return rb.GetBitmapNamed(IDR_DEFAULT_LARGE_FAVICON); |
| 653 #else | 656 #else |
| 654 return rb.GetBitmapNamed(IDR_DEFAULT_FAVICON); | 657 return rb.GetBitmapNamed(IDR_DEFAULT_FAVICON); |
| 655 #endif | 658 #endif |
| 656 } | 659 } |
| 657 | 660 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 731 | 734 |
| 732 return NULL; | 735 return NULL; |
| 733 } | 736 } |
| 734 | 737 |
| 735 QuotaPermissionContext* | 738 QuotaPermissionContext* |
| 736 ChromeContentBrowserClient::CreateQuotaPermissionContext() { | 739 ChromeContentBrowserClient::CreateQuotaPermissionContext() { |
| 737 return new ChromeQuotaPermissionContext(); | 740 return new ChromeQuotaPermissionContext(); |
| 738 } | 741 } |
| 739 | 742 |
| 740 void ChromeContentBrowserClient::OpenItem(const FilePath& path) { | 743 void ChromeContentBrowserClient::OpenItem(const FilePath& path) { |
| 741 // On Mac, this call needs to be done on the UI thread. On other platforms, | |
| 742 // do it on the FILE thread so we don't slow down UI. | |
| 743 #if defined(OS_MACOSX) | |
| 744 platform_util::OpenItem(path); | 744 platform_util::OpenItem(path); |
| 745 #else | |
| 746 BrowserThread::PostTask( | |
| 747 BrowserThread::FILE, FROM_HERE, | |
| 748 base::Bind(&platform_util::OpenItem, path)); | |
| 749 #endif | |
| 750 } | 745 } |
| 751 | 746 |
| 752 void ChromeContentBrowserClient::ShowItemInFolder(const FilePath& path) { | 747 void ChromeContentBrowserClient::ShowItemInFolder(const FilePath& path) { |
| 753 #if defined(OS_MACOSX) | |
| 754 // Mac needs to run this operation on the UI thread. | |
| 755 platform_util::ShowItemInFolder(path); | 748 platform_util::ShowItemInFolder(path); |
| 756 #else | |
| 757 BrowserThread::PostTask( | |
| 758 BrowserThread::FILE, FROM_HERE, | |
| 759 base::Bind(&platform_util::ShowItemInFolder, path)); | |
| 760 #endif | |
| 761 } | 749 } |
| 762 | 750 |
| 763 void ChromeContentBrowserClient::AllowCertificateError( | 751 void ChromeContentBrowserClient::AllowCertificateError( |
| 764 SSLCertErrorHandler* handler, | 752 SSLCertErrorHandler* handler, |
| 765 bool overridable, | 753 bool overridable, |
| 766 const base::Callback<void(SSLCertErrorHandler*, bool)>& callback) { | 754 const base::Callback<void(SSLCertErrorHandler*, bool)>& callback) { |
| 767 // If the tab is being prerendered, cancel the prerender and the request. | 755 // If the tab is being prerendered, cancel the prerender and the request. |
| 768 TabContents* tab = tab_util::GetTabContentsByID( | 756 TabContents* tab = tab_util::GetTabContentsByID( |
| 769 handler->render_process_host_id(), | 757 handler->render_process_host_id(), |
| 770 handler->tab_contents_id()); | 758 handler->tab_contents_id()); |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1061 #if defined(USE_NSS) | 1049 #if defined(USE_NSS) |
| 1062 crypto::CryptoModuleBlockingPasswordDelegate* | 1050 crypto::CryptoModuleBlockingPasswordDelegate* |
| 1063 ChromeContentBrowserClient::GetCryptoPasswordDelegate( | 1051 ChromeContentBrowserClient::GetCryptoPasswordDelegate( |
| 1064 const GURL& url) { | 1052 const GURL& url) { |
| 1065 return browser::NewCryptoModuleBlockingDialogDelegate( | 1053 return browser::NewCryptoModuleBlockingDialogDelegate( |
| 1066 browser::kCryptoModulePasswordKeygen, url.host()); | 1054 browser::kCryptoModulePasswordKeygen, url.host()); |
| 1067 } | 1055 } |
| 1068 #endif | 1056 #endif |
| 1069 | 1057 |
| 1070 } // namespace chrome | 1058 } // namespace chrome |
| OLD | NEW |