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

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

Issue 1459793002: Android: Allow compiling browser without Java UI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 <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
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 #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/chrome_browser_main_android.h" 185 #include "chrome/browser/chrome_browser_main_android.h"
188 #include "chrome/common/descriptors_android.h" 186 #include "chrome/common/descriptors_android.h"
189 #include "components/crash/content/browser/crash_dump_manager_android.h" 187 #include "components/crash/content/browser/crash_dump_manager_android.h"
190 #include "components/navigation_interception/intercept_navigation_delegate.h" 188 #include "components/navigation_interception/intercept_navigation_delegate.h"
191 #include "components/service_tab_launcher/browser/android/service_tab_launcher.h " 189 #include "components/service_tab_launcher/browser/android/service_tab_launcher.h "
192 #include "ui/base/resource/resource_bundle_android.h" 190 #include "ui/base/resource/resource_bundle_android.h"
193 #elif defined(OS_POSIX) 191 #elif defined(OS_POSIX)
194 #include "chrome/browser/chrome_browser_main_posix.h" 192 #include "chrome/browser/chrome_browser_main_posix.h"
195 #endif 193 #endif
196 194
197 #if defined(OS_POSIX) && !defined(OS_MACOSX) 195 #if defined(OS_POSIX) && !defined(OS_MACOSX)
198 #include "base/debug/leak_annotations.h" 196 #include "base/debug/leak_annotations.h"
199 #include "components/crash/content/app/breakpad_linux.h" 197 #include "components/crash/content/app/breakpad_linux.h"
200 #include "components/crash/content/browser/crash_handler_host_linux.h" 198 #include "components/crash/content/browser/crash_handler_host_linux.h"
201 #endif 199 #endif
202 200
201 #if defined(ANDROID_JAVA_UI)
202 #include "chrome/browser/android/new_tab_page_url_handler.h"
203 #include "chrome/browser/android/webapps/single_tab_mode_tab_helper.h"
204 #endif
205
203 #if defined(OS_ANDROID) 206 #if defined(OS_ANDROID)
204 #include "ui/base/ui_base_paths.h" 207 #include "ui/base/ui_base_paths.h"
205 #include "ui/gfx/android/device_display_info.h" 208 #include "ui/gfx/android/device_display_info.h"
206 #endif 209 #endif
207 210
208 #if defined(TOOLKIT_VIEWS) 211 #if defined(TOOLKIT_VIEWS)
209 #include "chrome/browser/ui/views/chrome_browser_main_extra_parts_views.h" 212 #include "chrome/browser/ui/views/chrome_browser_main_extra_parts_views.h"
210 #endif 213 #endif
211 214
212 #if defined(USE_ASH) 215 #if defined(USE_ASH)
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 safe_browsing_ui_manager_->ReportInvalidCertificateChain( 578 safe_browsing_ui_manager_->ReportInvalidCertificateChain(
576 serialized_report, base::Bind(&base::DoNothing)); 579 serialized_report, base::Bind(&base::DoNothing));
577 } 580 }
578 } 581 }
579 582
580 private: 583 private:
581 const scoped_refptr<safe_browsing::SafeBrowsingUIManager> 584 const scoped_refptr<safe_browsing::SafeBrowsingUIManager>
582 safe_browsing_ui_manager_; 585 safe_browsing_ui_manager_;
583 }; 586 };
584 587
585 #if defined(OS_ANDROID) 588 #if defined(ANDROID_JAVA_UI)
586
587 void HandleSingleTabModeBlockOnUIThread(const BlockedWindowParams& params) { 589 void HandleSingleTabModeBlockOnUIThread(const BlockedWindowParams& params) {
588 WebContents* web_contents = tab_util::GetWebContentsByFrameID( 590 WebContents* web_contents = tab_util::GetWebContentsByFrameID(
589 params.render_process_id(), params.opener_render_frame_id()); 591 params.render_process_id(), params.opener_render_frame_id());
590 if (!web_contents) 592 if (!web_contents)
591 return; 593 return;
592 594
593 SingleTabModeTabHelper::FromWebContents(web_contents)->HandleOpenUrl(params); 595 SingleTabModeTabHelper::FromWebContents(web_contents)->HandleOpenUrl(params);
594 } 596 }
597 #endif // defined(ANDROID_JAVA_UI)
595 598
599 #if defined(OS_ANDROID)
596 float GetDeviceScaleAdjustment() { 600 float GetDeviceScaleAdjustment() {
597 static const float kMinFSM = 1.05f; 601 static const float kMinFSM = 1.05f;
598 static const int kWidthForMinFSM = 320; 602 static const int kWidthForMinFSM = 320;
599 static const float kMaxFSM = 1.3f; 603 static const float kMaxFSM = 1.3f;
600 static const int kWidthForMaxFSM = 800; 604 static const int kWidthForMaxFSM = 800;
601 605
602 gfx::DeviceDisplayInfo info; 606 gfx::DeviceDisplayInfo info;
603 int minWidth = info.GetSmallestDIPWidth(); 607 int minWidth = info.GetSmallestDIPWidth();
604 608
605 if (minWidth <= kWidthForMinFSM) 609 if (minWidth <= kWidthForMinFSM)
606 return kMinFSM; 610 return kMinFSM;
607 if (minWidth >= kWidthForMaxFSM) 611 if (minWidth >= kWidthForMaxFSM)
608 return kMaxFSM; 612 return kMaxFSM;
609 613
610 // The font scale multiplier varies linearly between kMinFSM and kMaxFSM. 614 // The font scale multiplier varies linearly between kMinFSM and kMaxFSM.
611 float ratio = static_cast<float>(minWidth - kWidthForMinFSM) / 615 float ratio = static_cast<float>(minWidth - kWidthForMinFSM) /
612 (kWidthForMaxFSM - kWidthForMinFSM); 616 (kWidthForMaxFSM - kWidthForMinFSM);
613 return ratio * (kMaxFSM - kMinFSM) + kMinFSM; 617 return ratio * (kMaxFSM - kMinFSM) + kMinFSM;
614 } 618 }
615
616 #endif // defined(OS_ANDROID) 619 #endif // defined(OS_ANDROID)
617 620
618 #if defined(ENABLE_EXTENSIONS) 621 #if defined(ENABLE_EXTENSIONS)
619 // By default, JavaScript and images are enabled in guest content. 622 // By default, JavaScript and images are enabled in guest content.
620 void GetGuestViewDefaultContentSettingRules( 623 void GetGuestViewDefaultContentSettingRules(
621 bool incognito, 624 bool incognito,
622 RendererContentSettingRules* rules) { 625 RendererContentSettingRules* rules) {
623 rules->image_rules.push_back( 626 rules->image_rules.push_back(
624 ContentSettingPatternSource(ContentSettingsPattern::Wildcard(), 627 ContentSettingPatternSource(ContentSettingsPattern::Wildcard(),
625 ContentSettingsPattern::Wildcard(), 628 ContentSettingsPattern::Wildcard(),
(...skipping 1535 matching lines...) Expand 10 before | Expand all | Expand 10 after
2161 std::string()) != 2164 std::string()) !=
2162 CONTENT_SETTING_ALLOW) { 2165 CONTENT_SETTING_ALLOW) {
2163 BrowserThread::PostTask(BrowserThread::UI, 2166 BrowserThread::PostTask(BrowserThread::UI,
2164 FROM_HERE, 2167 FROM_HERE,
2165 base::Bind(&HandleBlockedPopupOnUIThread, 2168 base::Bind(&HandleBlockedPopupOnUIThread,
2166 blocked_params)); 2169 blocked_params));
2167 return false; 2170 return false;
2168 } 2171 }
2169 } 2172 }
2170 2173
2171 #if defined(OS_ANDROID) 2174 #if defined(ANDROID_JAVA_UI)
2172 if (SingleTabModeTabHelper::IsRegistered(render_process_id, 2175 if (SingleTabModeTabHelper::IsRegistered(render_process_id,
2173 opener_render_view_id)) { 2176 opener_render_view_id)) {
2174 BrowserThread::PostTask(BrowserThread::UI, 2177 BrowserThread::PostTask(BrowserThread::UI,
2175 FROM_HERE, 2178 FROM_HERE,
2176 base::Bind(&HandleSingleTabModeBlockOnUIThread, 2179 base::Bind(&HandleSingleTabModeBlockOnUIThread,
2177 blocked_params)); 2180 blocked_params));
2178 return false; 2181 return false;
2179 } 2182 }
2180 #endif 2183 #endif
2181 2184
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
2332 for (size_t i = 0; i < extra_parts_.size(); ++i) 2335 for (size_t i = 0; i < extra_parts_.size(); ++i)
2333 extra_parts_[i]->BrowserURLHandlerCreated(handler); 2336 extra_parts_[i]->BrowserURLHandlerCreated(handler);
2334 2337
2335 // about: handler. Must come before chrome: handler, since it will 2338 // about: handler. Must come before chrome: handler, since it will
2336 // rewrite about: urls to chrome: URLs and then expect chrome: to 2339 // rewrite about: urls to chrome: URLs and then expect chrome: to
2337 // actually handle them. Also relies on a preliminary fixup phase. 2340 // actually handle them. Also relies on a preliminary fixup phase.
2338 handler->SetFixupHandler(&FixupBrowserAboutURL); 2341 handler->SetFixupHandler(&FixupBrowserAboutURL);
2339 handler->AddHandlerPair(&WillHandleBrowserAboutURL, 2342 handler->AddHandlerPair(&WillHandleBrowserAboutURL,
2340 BrowserURLHandler::null_handler()); 2343 BrowserURLHandler::null_handler());
2341 2344
2342 #if defined(OS_ANDROID) 2345 #if defined(ANDROID_JAVA_UI)
2343 // Handler to rewrite chrome://newtab on Android. 2346 // Handler to rewrite chrome://newtab on Android.
2344 handler->AddHandlerPair(&chrome::android::HandleAndroidNativePageURL, 2347 handler->AddHandlerPair(&chrome::android::HandleAndroidNativePageURL,
2345 BrowserURLHandler::null_handler()); 2348 BrowserURLHandler::null_handler());
2346 #else 2349 #else
2347 // Handler to rewrite chrome://newtab for InstantExtended. 2350 // Handler to rewrite chrome://newtab for InstantExtended.
2348 handler->AddHandlerPair(&search::HandleNewTabURLRewrite, 2351 handler->AddHandlerPair(&search::HandleNewTabURLRewrite,
2349 &search::HandleNewTabURLReverseRewrite); 2352 &search::HandleNewTabURLReverseRewrite);
2350 #endif 2353 #endif
2351 2354
2352 // chrome: & friends. 2355 // chrome: & friends.
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
2778 if (channel <= kMaxDisableEncryptionChannel) { 2781 if (channel <= kMaxDisableEncryptionChannel) {
2779 static const char* const kWebRtcDevSwitchNames[] = { 2782 static const char* const kWebRtcDevSwitchNames[] = {
2780 switches::kDisableWebRtcEncryption, 2783 switches::kDisableWebRtcEncryption,
2781 }; 2784 };
2782 to_command_line->CopySwitchesFrom(from_command_line, 2785 to_command_line->CopySwitchesFrom(from_command_line,
2783 kWebRtcDevSwitchNames, 2786 kWebRtcDevSwitchNames,
2784 arraysize(kWebRtcDevSwitchNames)); 2787 arraysize(kWebRtcDevSwitchNames));
2785 } 2788 }
2786 } 2789 }
2787 #endif // defined(ENABLE_WEBRTC) 2790 #endif // defined(ENABLE_WEBRTC)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698