Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 175 #include "chrome/app/breakpad_linux.h" | 175 #include "chrome/app/breakpad_linux.h" |
| 176 #include "chrome/browser/crash_handler_host_linux.h" | 176 #include "chrome/browser/crash_handler_host_linux.h" |
| 177 #endif | 177 #endif |
| 178 | 178 |
| 179 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) | 179 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) |
| 180 #include "chrome/browser/captive_portal/captive_portal_tab_helper.h" | 180 #include "chrome/browser/captive_portal/captive_portal_tab_helper.h" |
| 181 #endif | 181 #endif |
| 182 | 182 |
| 183 #if defined(OS_ANDROID) | 183 #if defined(OS_ANDROID) |
| 184 #include "ui/base/ui_base_paths.h" | 184 #include "ui/base/ui_base_paths.h" |
| 185 #include "ui/gfx/android/device_display_info.h" | |
| 185 #endif | 186 #endif |
| 186 | 187 |
| 187 #if defined(USE_NSS) | 188 #if defined(USE_NSS) |
| 188 #include "chrome/browser/ui/crypto_module_password_dialog.h" | 189 #include "chrome/browser/ui/crypto_module_password_dialog.h" |
| 189 #endif | 190 #endif |
| 190 | 191 |
| 191 #if !defined(OS_CHROMEOS) | 192 #if !defined(OS_CHROMEOS) |
| 192 #include "chrome/browser/signin/signin_manager.h" | 193 #include "chrome/browser/signin/signin_manager.h" |
| 193 #include "chrome/browser/signin/signin_manager_factory.h" | 194 #include "chrome/browser/signin/signin_manager_factory.h" |
| 194 #endif | 195 #endif |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 542 return; | 543 return; |
| 543 | 544 |
| 544 PopupBlockerTabHelper* popup_helper = | 545 PopupBlockerTabHelper* popup_helper = |
| 545 PopupBlockerTabHelper::FromWebContents(tab); | 546 PopupBlockerTabHelper::FromWebContents(tab); |
| 546 if (!popup_helper) | 547 if (!popup_helper) |
| 547 return; | 548 return; |
| 548 popup_helper->AddBlockedPopup(params); | 549 popup_helper->AddBlockedPopup(params); |
| 549 } | 550 } |
| 550 | 551 |
| 551 #if defined(OS_ANDROID) | 552 #if defined(OS_ANDROID) |
| 553 | |
| 552 void HandleSingleTabModeBlockOnUIThread(const BlockedWindowParams& params) { | 554 void HandleSingleTabModeBlockOnUIThread(const BlockedWindowParams& params) { |
| 553 WebContents* web_contents = | 555 WebContents* web_contents = |
| 554 tab_util::GetWebContentsByID(params.render_process_id(), | 556 tab_util::GetWebContentsByID(params.render_process_id(), |
| 555 params.opener_id()); | 557 params.opener_id()); |
| 556 if (!web_contents) | 558 if (!web_contents) |
| 557 return; | 559 return; |
| 558 | 560 |
| 559 SingleTabModeTabHelper::FromWebContents(web_contents)->HandleOpenUrl(params); | 561 SingleTabModeTabHelper::FromWebContents(web_contents)->HandleOpenUrl(params); |
| 560 } | 562 } |
| 563 | |
| 564 float GetFontScaleMultiplier(const PrefService* prefs) { | |
| 565 if (prefs->GetBoolean(prefs::kWebKitFontScaleFactorQuirk)) { | |
| 566 // The value of kWebKitFontScaleFactor passed by Chrome for Android already | |
| 567 // includes the multiplier. | |
| 568 return 1.0f; | |
| 569 } | |
| 570 | |
| 571 const float kMinFSM = 1.05f; | |
|
jamesr
2013/10/21 22:32:26
add 'static'
skobes
2013/10/21 22:35:58
Done.
| |
| 572 const int kWidthForMinFSM = 320; | |
| 573 const float kMaxFSM = 1.3f; | |
| 574 const int kWidthForMaxFSM = 800; | |
| 575 | |
| 576 gfx::DeviceDisplayInfo info; | |
| 577 int minWidth = info.GetSmallestDIPWidth(); | |
| 578 | |
| 579 if (minWidth <= kWidthForMinFSM) | |
| 580 return kMinFSM; | |
| 581 if (minWidth >= kWidthForMaxFSM) | |
| 582 return kMaxFSM; | |
| 583 | |
| 584 // The font scale multiplier varies linearly between kMinFSM and kMaxFSM. | |
| 585 float ratio = static_cast<float>(minWidth - kWidthForMinFSM) / | |
| 586 (kWidthForMaxFSM - kWidthForMinFSM); | |
| 587 return ratio * (kMaxFSM - kMinFSM) + kMinFSM; | |
| 588 } | |
| 589 | |
| 561 #endif // defined(OS_ANDROID) | 590 #endif // defined(OS_ANDROID) |
| 562 | 591 |
| 563 } // namespace | 592 } // namespace |
| 564 | 593 |
| 565 namespace chrome { | 594 namespace chrome { |
| 566 | 595 |
| 567 ChromeContentBrowserClient::ChromeContentBrowserClient() { | 596 ChromeContentBrowserClient::ChromeContentBrowserClient() { |
| 568 #if defined(ENABLE_PLUGINS) | 597 #if defined(ENABLE_PLUGINS) |
| 569 for (size_t i = 0; i < arraysize(kPredefinedAllowedSocketOrigins); ++i) | 598 for (size_t i = 0; i < arraysize(kPredefinedAllowedSocketOrigins); ++i) |
| 570 allowed_socket_origins_.insert(kPredefinedAllowedSocketOrigins[i]); | 599 allowed_socket_origins_.insert(kPredefinedAllowedSocketOrigins[i]); |
| (...skipping 1579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2150 if (prefs->GetBoolean(prefs::kDisable3DAPIs)) | 2179 if (prefs->GetBoolean(prefs::kDisable3DAPIs)) |
| 2151 web_prefs->experimental_webgl_enabled = false; | 2180 web_prefs->experimental_webgl_enabled = false; |
| 2152 | 2181 |
| 2153 web_prefs->memory_info_enabled = | 2182 web_prefs->memory_info_enabled = |
| 2154 prefs->GetBoolean(prefs::kEnableMemoryInfo); | 2183 prefs->GetBoolean(prefs::kEnableMemoryInfo); |
| 2155 web_prefs->allow_displaying_insecure_content = | 2184 web_prefs->allow_displaying_insecure_content = |
| 2156 prefs->GetBoolean(prefs::kWebKitAllowDisplayingInsecureContent); | 2185 prefs->GetBoolean(prefs::kWebKitAllowDisplayingInsecureContent); |
| 2157 web_prefs->allow_running_insecure_content = | 2186 web_prefs->allow_running_insecure_content = |
| 2158 prefs->GetBoolean(prefs::kWebKitAllowRunningInsecureContent); | 2187 prefs->GetBoolean(prefs::kWebKitAllowRunningInsecureContent); |
| 2159 #if defined(OS_ANDROID) | 2188 #if defined(OS_ANDROID) |
| 2160 web_prefs->font_scale_factor = | 2189 web_prefs->text_autosizing_font_scale_factor = |
| 2161 static_cast<float>(prefs->GetDouble(prefs::kWebKitFontScaleFactor)); | 2190 static_cast<float>(prefs->GetDouble(prefs::kWebKitFontScaleFactor)) * |
| 2191 GetFontScaleMultiplier(prefs); | |
| 2162 web_prefs->force_enable_zoom = | 2192 web_prefs->force_enable_zoom = |
| 2163 prefs->GetBoolean(prefs::kWebKitForceEnableZoom); | 2193 prefs->GetBoolean(prefs::kWebKitForceEnableZoom); |
| 2164 #endif | 2194 #endif |
| 2165 | 2195 |
| 2166 #if defined(OS_ANDROID) | 2196 #if defined(OS_ANDROID) |
| 2167 web_prefs->password_echo_enabled = | 2197 web_prefs->password_echo_enabled = |
| 2168 prefs->GetBoolean(prefs::kWebKitPasswordEchoEnabled); | 2198 prefs->GetBoolean(prefs::kWebKitPasswordEchoEnabled); |
| 2169 #else | 2199 #else |
| 2170 web_prefs->password_echo_enabled = browser_defaults::kPasswordEchoEnabled; | 2200 web_prefs->password_echo_enabled = browser_defaults::kPasswordEchoEnabled; |
| 2171 #endif | 2201 #endif |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2572 return IsExtensionOrSharedModuleWhitelisted(url, extension_set, | 2602 return IsExtensionOrSharedModuleWhitelisted(url, extension_set, |
| 2573 allowed_file_handle_origins_) || | 2603 allowed_file_handle_origins_) || |
| 2574 IsHostAllowedByCommandLine(url, extension_set, | 2604 IsHostAllowedByCommandLine(url, extension_set, |
| 2575 switches::kAllowNaClFileHandleAPI); | 2605 switches::kAllowNaClFileHandleAPI); |
| 2576 #else | 2606 #else |
| 2577 return false; | 2607 return false; |
| 2578 #endif | 2608 #endif |
| 2579 } | 2609 } |
| 2580 | 2610 |
| 2581 } // namespace chrome | 2611 } // namespace chrome |
| OLD | NEW |