| 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/command_line.h" | 10 #include "base/command_line.h" |
| 8 #include "chrome/app/breakpad_mac.h" | 11 #include "chrome/app/breakpad_mac.h" |
| 9 #include "chrome/browser/browser_about_handler.h" | 12 #include "chrome/browser/browser_about_handler.h" |
| 10 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
| 11 #include "chrome/browser/browsing_data_remover.h" | 14 #include "chrome/browser/browsing_data_remover.h" |
| 12 #include "chrome/browser/character_encoding.h" | 15 #include "chrome/browser/character_encoding.h" |
| 13 #include "chrome/browser/chrome_benchmarking_message_filter.h" | 16 #include "chrome/browser/chrome_benchmarking_message_filter.h" |
| 14 #include "chrome/browser/chrome_plugin_message_filter.h" | 17 #include "chrome/browser/chrome_plugin_message_filter.h" |
| 15 #include "chrome/browser/chrome_quota_permission_context.h" | 18 #include "chrome/browser/chrome_quota_permission_context.h" |
| 16 #include "chrome/browser/chrome_worker_message_filter.h" | 19 #include "chrome/browser/chrome_worker_message_filter.h" |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 std::string ChromeContentBrowserClient::GetApplicationLocale() { | 573 std::string ChromeContentBrowserClient::GetApplicationLocale() { |
| 571 return g_browser_process->GetApplicationLocale(); | 574 return g_browser_process->GetApplicationLocale(); |
| 572 } | 575 } |
| 573 | 576 |
| 574 std::string ChromeContentBrowserClient::GetAcceptLangs(const TabContents* tab) { | 577 std::string ChromeContentBrowserClient::GetAcceptLangs(const TabContents* tab) { |
| 575 Profile* profile = Profile::FromBrowserContext(tab->browser_context()); | 578 Profile* profile = Profile::FromBrowserContext(tab->browser_context()); |
| 576 return profile->GetPrefs()->GetString(prefs::kAcceptLanguages); | 579 return profile->GetPrefs()->GetString(prefs::kAcceptLanguages); |
| 577 } | 580 } |
| 578 | 581 |
| 579 SkBitmap* ChromeContentBrowserClient::GetDefaultFavicon() { | 582 SkBitmap* ChromeContentBrowserClient::GetDefaultFavicon() { |
| 580 ResourceBundle &rb = ResourceBundle::GetSharedInstance(); | 583 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 581 #if defined(TOUCH_UI) | 584 #if defined(TOUCH_UI) |
| 582 // In touch builds, we want large default favicons for the tabstrip, but in | 585 // In touch builds, we want large default favicons for the tabstrip, but in |
| 583 // other places (such as bookmark, manage search engines, homepage) we assume | 586 // other places (such as bookmark, manage search engines, homepage) we assume |
| 584 // default favicons are 16x16. | 587 // default favicons are 16x16. |
| 585 return rb.GetBitmapNamed(IDR_DEFAULT_LARGE_FAVICON); | 588 return rb.GetBitmapNamed(IDR_DEFAULT_LARGE_FAVICON); |
| 586 #else | 589 #else |
| 587 return rb.GetBitmapNamed(IDR_DEFAULT_FAVICON); | 590 return rb.GetBitmapNamed(IDR_DEFAULT_FAVICON); |
| 588 #endif | 591 #endif |
| 589 } | 592 } |
| 590 | 593 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 | 670 |
| 668 return NULL; | 671 return NULL; |
| 669 } | 672 } |
| 670 | 673 |
| 671 QuotaPermissionContext* | 674 QuotaPermissionContext* |
| 672 ChromeContentBrowserClient::CreateQuotaPermissionContext() { | 675 ChromeContentBrowserClient::CreateQuotaPermissionContext() { |
| 673 return new ChromeQuotaPermissionContext(); | 676 return new ChromeQuotaPermissionContext(); |
| 674 } | 677 } |
| 675 | 678 |
| 676 void ChromeContentBrowserClient::OpenItem(const FilePath& path) { | 679 void ChromeContentBrowserClient::OpenItem(const FilePath& path) { |
| 677 // On Mac, this call needs to be done on the UI thread. On other platforms, | |
| 678 // do it on the FILE thread so we don't slow down UI. | |
| 679 #if defined(OS_MACOSX) | |
| 680 platform_util::OpenItem(path); | 680 platform_util::OpenItem(path); |
| 681 #else | |
| 682 BrowserThread::PostTask( | |
| 683 BrowserThread::FILE, FROM_HERE, | |
| 684 NewRunnableFunction(&platform_util::OpenItem, path)); | |
| 685 #endif | |
| 686 } | 681 } |
| 687 | 682 |
| 688 void ChromeContentBrowserClient::ShowItemInFolder(const FilePath& path) { | 683 void ChromeContentBrowserClient::ShowItemInFolder(const FilePath& path) { |
| 689 #if defined(OS_MACOSX) | |
| 690 // Mac needs to run this operation on the UI thread. | |
| 691 platform_util::ShowItemInFolder(path); | 684 platform_util::ShowItemInFolder(path); |
| 692 #else | |
| 693 BrowserThread::PostTask( | |
| 694 BrowserThread::FILE, FROM_HERE, | |
| 695 NewRunnableFunction(&platform_util::ShowItemInFolder, path)); | |
| 696 #endif | |
| 697 } | 685 } |
| 698 | 686 |
| 699 void ChromeContentBrowserClient::AllowCertificateError( | 687 void ChromeContentBrowserClient::AllowCertificateError( |
| 700 SSLCertErrorHandler* handler, | 688 SSLCertErrorHandler* handler, |
| 701 bool overridable, | 689 bool overridable, |
| 702 const base::Callback<void(SSLCertErrorHandler*, bool)>& callback) { | 690 const base::Callback<void(SSLCertErrorHandler*, bool)>& callback) { |
| 703 // If the tab is being prerendered, cancel the prerender and the request. | 691 // If the tab is being prerendered, cancel the prerender and the request. |
| 704 TabContents* tab = tab_util::GetTabContentsByID( | 692 TabContents* tab = tab_util::GetTabContentsByID( |
| 705 handler->render_process_host_id(), | 693 handler->render_process_host_id(), |
| 706 handler->tab_contents_id()); | 694 handler->tab_contents_id()); |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 997 #if defined(USE_NSS) | 985 #if defined(USE_NSS) |
| 998 crypto::CryptoModuleBlockingPasswordDelegate* | 986 crypto::CryptoModuleBlockingPasswordDelegate* |
| 999 ChromeContentBrowserClient::GetCryptoPasswordDelegate( | 987 ChromeContentBrowserClient::GetCryptoPasswordDelegate( |
| 1000 const GURL& url) { | 988 const GURL& url) { |
| 1001 return browser::NewCryptoModuleBlockingDialogDelegate( | 989 return browser::NewCryptoModuleBlockingDialogDelegate( |
| 1002 browser::kCryptoModulePasswordKeygen, url.host()); | 990 browser::kCryptoModulePasswordKeygen, url.host()); |
| 1003 } | 991 } |
| 1004 #endif | 992 #endif |
| 1005 | 993 |
| 1006 } // namespace chrome | 994 } // namespace chrome |
| OLD | NEW |