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 <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
175 #include "chrome/browser/chromeos/login/signin/merge_session_navigation_throttle .h" | 175 #include "chrome/browser/chromeos/login/signin/merge_session_navigation_throttle .h" |
176 #include "chrome/browser/chromeos/login/signin/merge_session_throttling_utils.h" | 176 #include "chrome/browser/chromeos/login/signin/merge_session_throttling_utils.h" |
177 #include "chrome/browser/chromeos/login/startup_utils.h" | 177 #include "chrome/browser/chromeos/login/startup_utils.h" |
178 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 178 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
179 #include "chrome/browser/chromeos/system/input_device_settings.h" | 179 #include "chrome/browser/chromeos/system/input_device_settings.h" |
180 #include "chromeos/chromeos_switches.h" | 180 #include "chromeos/chromeos_switches.h" |
181 #include "components/user_manager/user_manager.h" | 181 #include "components/user_manager/user_manager.h" |
182 #elif defined(OS_LINUX) | 182 #elif defined(OS_LINUX) |
183 #include "chrome/browser/chrome_browser_main_linux.h" | 183 #include "chrome/browser/chrome_browser_main_linux.h" |
184 #elif defined(OS_ANDROID) | 184 #elif defined(OS_ANDROID) |
185 #if !defined(USE_AURA) | |
mfomitchev
2015/11/25 22:31:20
For includes and API declarations, I think sievers
bshe
2015/11/26 15:22:20
Done.
| |
185 #include "chrome/browser/android/new_tab_page_url_handler.h" | 186 #include "chrome/browser/android/new_tab_page_url_handler.h" |
186 #include "chrome/browser/android/webapps/single_tab_mode_tab_helper.h" | 187 #include "chrome/browser/android/webapps/single_tab_mode_tab_helper.h" |
188 #include "components/service_tab_launcher/browser/android/service_tab_launcher.h " | |
189 #endif | |
187 #include "chrome/browser/chrome_browser_main_android.h" | 190 #include "chrome/browser/chrome_browser_main_android.h" |
188 #include "chrome/common/descriptors_android.h" | 191 #include "chrome/common/descriptors_android.h" |
189 #include "components/crash/content/browser/crash_dump_manager_android.h" | 192 #include "components/crash/content/browser/crash_dump_manager_android.h" |
190 #include "components/navigation_interception/intercept_navigation_delegate.h" | 193 #include "components/navigation_interception/intercept_navigation_delegate.h" |
191 #include "components/service_tab_launcher/browser/android/service_tab_launcher.h " | |
192 #include "ui/base/resource/resource_bundle_android.h" | 194 #include "ui/base/resource/resource_bundle_android.h" |
193 #elif defined(OS_POSIX) | 195 #elif defined(OS_POSIX) |
194 #include "chrome/browser/chrome_browser_main_posix.h" | 196 #include "chrome/browser/chrome_browser_main_posix.h" |
195 #endif | 197 #endif |
196 | 198 |
197 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 199 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
198 #include "base/debug/leak_annotations.h" | 200 #include "base/debug/leak_annotations.h" |
199 #include "components/crash/content/app/breakpad_linux.h" | 201 #include "components/crash/content/app/breakpad_linux.h" |
200 #include "components/crash/content/browser/crash_handler_host_linux.h" | 202 #include "components/crash/content/browser/crash_handler_host_linux.h" |
201 #endif | 203 #endif |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
580 serialized_report, base::Bind(&base::DoNothing)); | 582 serialized_report, base::Bind(&base::DoNothing)); |
581 } | 583 } |
582 } | 584 } |
583 | 585 |
584 private: | 586 private: |
585 const scoped_refptr<safe_browsing::SafeBrowsingUIManager> | 587 const scoped_refptr<safe_browsing::SafeBrowsingUIManager> |
586 safe_browsing_ui_manager_; | 588 safe_browsing_ui_manager_; |
587 }; | 589 }; |
588 | 590 |
589 #if defined(OS_ANDROID) | 591 #if defined(OS_ANDROID) |
590 | 592 #if !defined(USE_AURA) |
591 void HandleSingleTabModeBlockOnUIThread(const BlockedWindowParams& params) { | 593 void HandleSingleTabModeBlockOnUIThread(const BlockedWindowParams& params) { |
592 WebContents* web_contents = tab_util::GetWebContentsByFrameID( | 594 WebContents* web_contents = tab_util::GetWebContentsByFrameID( |
593 params.render_process_id(), params.opener_render_frame_id()); | 595 params.render_process_id(), params.opener_render_frame_id()); |
594 if (!web_contents) | 596 if (!web_contents) |
595 return; | 597 return; |
596 | 598 |
597 SingleTabModeTabHelper::FromWebContents(web_contents)->HandleOpenUrl(params); | 599 SingleTabModeTabHelper::FromWebContents(web_contents)->HandleOpenUrl(params); |
598 } | 600 } |
601 #endif | |
599 | 602 |
600 float GetDeviceScaleAdjustment() { | 603 float GetDeviceScaleAdjustment() { |
601 static const float kMinFSM = 1.05f; | 604 static const float kMinFSM = 1.05f; |
602 static const int kWidthForMinFSM = 320; | 605 static const int kWidthForMinFSM = 320; |
603 static const float kMaxFSM = 1.3f; | 606 static const float kMaxFSM = 1.3f; |
604 static const int kWidthForMaxFSM = 800; | 607 static const int kWidthForMaxFSM = 800; |
605 | 608 |
606 gfx::DeviceDisplayInfo info; | 609 gfx::DeviceDisplayInfo info; |
607 int minWidth = info.GetSmallestDIPWidth(); | 610 int minWidth = info.GetSmallestDIPWidth(); |
608 | 611 |
609 if (minWidth <= kWidthForMinFSM) | 612 if (minWidth <= kWidthForMinFSM) |
610 return kMinFSM; | 613 return kMinFSM; |
611 if (minWidth >= kWidthForMaxFSM) | 614 if (minWidth >= kWidthForMaxFSM) |
612 return kMaxFSM; | 615 return kMaxFSM; |
613 | 616 |
614 // The font scale multiplier varies linearly between kMinFSM and kMaxFSM. | 617 // The font scale multiplier varies linearly between kMinFSM and kMaxFSM. |
615 float ratio = static_cast<float>(minWidth - kWidthForMinFSM) / | 618 float ratio = static_cast<float>(minWidth - kWidthForMinFSM) / |
616 (kWidthForMaxFSM - kWidthForMinFSM); | 619 (kWidthForMaxFSM - kWidthForMinFSM); |
617 return ratio * (kMaxFSM - kMinFSM) + kMinFSM; | 620 return ratio * (kMaxFSM - kMinFSM) + kMinFSM; |
618 } | 621 } |
619 | |
620 #endif // defined(OS_ANDROID) | 622 #endif // defined(OS_ANDROID) |
621 | 623 |
622 #if defined(ENABLE_EXTENSIONS) | 624 #if defined(ENABLE_EXTENSIONS) |
623 // By default, JavaScript and images are enabled in guest content. | 625 // By default, JavaScript and images are enabled in guest content. |
624 void GetGuestViewDefaultContentSettingRules( | 626 void GetGuestViewDefaultContentSettingRules( |
625 bool incognito, | 627 bool incognito, |
626 RendererContentSettingRules* rules) { | 628 RendererContentSettingRules* rules) { |
627 rules->image_rules.push_back( | 629 rules->image_rules.push_back( |
628 ContentSettingPatternSource(ContentSettingsPattern::Wildcard(), | 630 ContentSettingPatternSource(ContentSettingsPattern::Wildcard(), |
629 ContentSettingsPattern::Wildcard(), | 631 ContentSettingsPattern::Wildcard(), |
(...skipping 1539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2169 std::string()) != | 2171 std::string()) != |
2170 CONTENT_SETTING_ALLOW) { | 2172 CONTENT_SETTING_ALLOW) { |
2171 BrowserThread::PostTask(BrowserThread::UI, | 2173 BrowserThread::PostTask(BrowserThread::UI, |
2172 FROM_HERE, | 2174 FROM_HERE, |
2173 base::Bind(&HandleBlockedPopupOnUIThread, | 2175 base::Bind(&HandleBlockedPopupOnUIThread, |
2174 blocked_params)); | 2176 blocked_params)); |
2175 return false; | 2177 return false; |
2176 } | 2178 } |
2177 } | 2179 } |
2178 | 2180 |
2179 #if defined(OS_ANDROID) | 2181 #if defined(OS_ANDROID) && !defined(USE_AURA) |
2180 if (SingleTabModeTabHelper::IsRegistered(render_process_id, | 2182 if (SingleTabModeTabHelper::IsRegistered(render_process_id, |
2181 opener_render_view_id)) { | 2183 opener_render_view_id)) { |
2182 BrowserThread::PostTask(BrowserThread::UI, | 2184 BrowserThread::PostTask(BrowserThread::UI, |
2183 FROM_HERE, | 2185 FROM_HERE, |
2184 base::Bind(&HandleSingleTabModeBlockOnUIThread, | 2186 base::Bind(&HandleSingleTabModeBlockOnUIThread, |
2185 blocked_params)); | 2187 blocked_params)); |
2186 return false; | 2188 return false; |
2187 } | 2189 } |
2188 #endif | 2190 #endif |
2189 | 2191 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2340 for (size_t i = 0; i < extra_parts_.size(); ++i) | 2342 for (size_t i = 0; i < extra_parts_.size(); ++i) |
2341 extra_parts_[i]->BrowserURLHandlerCreated(handler); | 2343 extra_parts_[i]->BrowserURLHandlerCreated(handler); |
2342 | 2344 |
2343 // about: handler. Must come before chrome: handler, since it will | 2345 // about: handler. Must come before chrome: handler, since it will |
2344 // rewrite about: urls to chrome: URLs and then expect chrome: to | 2346 // rewrite about: urls to chrome: URLs and then expect chrome: to |
2345 // actually handle them. Also relies on a preliminary fixup phase. | 2347 // actually handle them. Also relies on a preliminary fixup phase. |
2346 handler->SetFixupHandler(&FixupBrowserAboutURL); | 2348 handler->SetFixupHandler(&FixupBrowserAboutURL); |
2347 handler->AddHandlerPair(&WillHandleBrowserAboutURL, | 2349 handler->AddHandlerPair(&WillHandleBrowserAboutURL, |
2348 BrowserURLHandler::null_handler()); | 2350 BrowserURLHandler::null_handler()); |
2349 | 2351 |
2350 #if defined(OS_ANDROID) | 2352 #if defined(OS_ANDROID) && !defined(USE_AURA) |
2351 // Handler to rewrite chrome://newtab on Android. | 2353 // Handler to rewrite chrome://newtab on Android. |
2352 handler->AddHandlerPair(&chrome::android::HandleAndroidNativePageURL, | 2354 handler->AddHandlerPair(&chrome::android::HandleAndroidNativePageURL, |
2353 BrowserURLHandler::null_handler()); | 2355 BrowserURLHandler::null_handler()); |
2354 #else | 2356 #else |
2355 // Handler to rewrite chrome://newtab for InstantExtended. | 2357 // Handler to rewrite chrome://newtab for InstantExtended. |
2356 handler->AddHandlerPair(&search::HandleNewTabURLRewrite, | 2358 handler->AddHandlerPair(&search::HandleNewTabURLRewrite, |
2357 &search::HandleNewTabURLReverseRewrite); | 2359 &search::HandleNewTabURLReverseRewrite); |
2358 #endif | 2360 #endif |
2359 | 2361 |
2360 // chrome: & friends. | 2362 // chrome: & friends. |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2626 base::ASCIIToUTF16("Media App"))); | 2628 base::ASCIIToUTF16("Media App"))); |
2627 #endif | 2629 #endif |
2628 } | 2630 } |
2629 | 2631 |
2630 void ChromeContentBrowserClient::OpenURL( | 2632 void ChromeContentBrowserClient::OpenURL( |
2631 content::BrowserContext* browser_context, | 2633 content::BrowserContext* browser_context, |
2632 const content::OpenURLParams& params, | 2634 const content::OpenURLParams& params, |
2633 const base::Callback<void(content::WebContents*)>& callback) { | 2635 const base::Callback<void(content::WebContents*)>& callback) { |
2634 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 2636 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
2635 | 2637 |
2636 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 2638 #if (!defined(OS_ANDROID) || defined(USE_AURA)) && !defined(OS_IOS) |
mfomitchev
2015/11/25 22:31:20
I wonder if it would be better to start using ANDR
bshe
2015/11/26 15:22:20
Added a TODO. I suspect if I try to land before hi
| |
2637 chrome::NavigateParams nav_params( | 2639 chrome::NavigateParams nav_params( |
2638 Profile::FromBrowserContext(browser_context), | 2640 Profile::FromBrowserContext(browser_context), |
2639 params.url, | 2641 params.url, |
2640 params.transition); | 2642 params.transition); |
2641 FillNavigateParamsFromOpenURLParams(&nav_params, params); | 2643 FillNavigateParamsFromOpenURLParams(&nav_params, params); |
2642 nav_params.user_gesture = params.user_gesture; | 2644 nav_params.user_gesture = params.user_gesture; |
2643 | 2645 |
2644 Navigate(&nav_params); | 2646 Navigate(&nav_params); |
2645 callback.Run(nav_params.target_contents); | 2647 callback.Run(nav_params.target_contents); |
2646 #elif defined(OS_ANDROID) | 2648 #elif defined(OS_ANDROID) |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2786 if (channel <= kMaxDisableEncryptionChannel) { | 2788 if (channel <= kMaxDisableEncryptionChannel) { |
2787 static const char* const kWebRtcDevSwitchNames[] = { | 2789 static const char* const kWebRtcDevSwitchNames[] = { |
2788 switches::kDisableWebRtcEncryption, | 2790 switches::kDisableWebRtcEncryption, |
2789 }; | 2791 }; |
2790 to_command_line->CopySwitchesFrom(from_command_line, | 2792 to_command_line->CopySwitchesFrom(from_command_line, |
2791 kWebRtcDevSwitchNames, | 2793 kWebRtcDevSwitchNames, |
2792 arraysize(kWebRtcDevSwitchNames)); | 2794 arraysize(kWebRtcDevSwitchNames)); |
2793 } | 2795 } |
2794 } | 2796 } |
2795 #endif // defined(ENABLE_WEBRTC) | 2797 #endif // defined(ENABLE_WEBRTC) |
OLD | NEW |