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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 #include "chrome/browser/tab_contents/tab_util.h" | 75 #include "chrome/browser/tab_contents/tab_util.h" |
76 #include "chrome/browser/ui/blocked_content/blocked_window_params.h" | 76 #include "chrome/browser/ui/blocked_content/blocked_window_params.h" |
77 #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h" | 77 #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h" |
78 #include "chrome/browser/ui/chrome_select_file_policy.h" | 78 #include "chrome/browser/ui/chrome_select_file_policy.h" |
79 #include "chrome/browser/ui/sync/sync_promo_ui.h" | 79 #include "chrome/browser/ui/sync/sync_promo_ui.h" |
80 #include "chrome/browser/ui/tab_contents/chrome_web_contents_view_delegate.h" | 80 #include "chrome/browser/ui/tab_contents/chrome_web_contents_view_delegate.h" |
81 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" | 81 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" |
82 #include "chrome/common/chrome_constants.h" | 82 #include "chrome/common/chrome_constants.h" |
83 #include "chrome/common/chrome_paths.h" | 83 #include "chrome/common/chrome_paths.h" |
84 #include "chrome/common/chrome_switches.h" | 84 #include "chrome/common/chrome_switches.h" |
| 85 #include "chrome/common/content_settings.h" |
85 #include "chrome/common/env_vars.h" | 86 #include "chrome/common/env_vars.h" |
86 #include "chrome/common/logging_chrome.h" | 87 #include "chrome/common/logging_chrome.h" |
87 #include "chrome/common/pepper_permission_util.h" | 88 #include "chrome/common/pepper_permission_util.h" |
88 #include "chrome/common/pref_names.h" | 89 #include "chrome/common/pref_names.h" |
89 #include "chrome/common/render_messages.h" | 90 #include "chrome/common/render_messages.h" |
90 #include "chrome/common/url_constants.h" | 91 #include "chrome/common/url_constants.h" |
91 #include "chrome/installer/util/google_update_settings.h" | 92 #include "chrome/installer/util/google_update_settings.h" |
92 #include "chromeos/chromeos_constants.h" | 93 #include "chromeos/chromeos_constants.h" |
93 #include "components/cdm/browser/cdm_message_filter_android.h" | 94 #include "components/cdm/browser/cdm_message_filter_android.h" |
94 #include "components/cloud_devices/common/cloud_devices_switches.h" | 95 #include "components/cloud_devices/common/cloud_devices_switches.h" |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 return kMaxFSM; | 552 return kMaxFSM; |
552 | 553 |
553 // The font scale multiplier varies linearly between kMinFSM and kMaxFSM. | 554 // The font scale multiplier varies linearly between kMinFSM and kMaxFSM. |
554 float ratio = static_cast<float>(minWidth - kWidthForMinFSM) / | 555 float ratio = static_cast<float>(minWidth - kWidthForMinFSM) / |
555 (kWidthForMaxFSM - kWidthForMinFSM); | 556 (kWidthForMaxFSM - kWidthForMinFSM); |
556 return ratio * (kMaxFSM - kMinFSM) + kMinFSM; | 557 return ratio * (kMaxFSM - kMinFSM) + kMinFSM; |
557 } | 558 } |
558 | 559 |
559 #endif // defined(OS_ANDROID) | 560 #endif // defined(OS_ANDROID) |
560 | 561 |
| 562 #if defined(ENABLE_EXTENSIONS) |
| 563 // By default, JavaScript and images are enabled in guest content. |
| 564 void GetGuestViewDefaultContentSettingRules( |
| 565 bool incognito, |
| 566 RendererContentSettingRules* rules) { |
| 567 rules->image_rules.push_back( |
| 568 ContentSettingPatternSource(ContentSettingsPattern::Wildcard(), |
| 569 ContentSettingsPattern::Wildcard(), |
| 570 CONTENT_SETTING_ALLOW, |
| 571 std::string(), |
| 572 incognito)); |
| 573 |
| 574 rules->script_rules.push_back( |
| 575 ContentSettingPatternSource(ContentSettingsPattern::Wildcard(), |
| 576 ContentSettingsPattern::Wildcard(), |
| 577 CONTENT_SETTING_ALLOW, |
| 578 std::string(), |
| 579 incognito)); |
| 580 } |
| 581 #endif // defined(ENALBE_EXTENSIONS) |
| 582 |
561 } // namespace | 583 } // namespace |
562 | 584 |
563 namespace chrome { | 585 namespace chrome { |
564 | 586 |
565 ChromeContentBrowserClient::ChromeContentBrowserClient() | 587 ChromeContentBrowserClient::ChromeContentBrowserClient() |
566 : prerender_tracker_(NULL), | 588 : prerender_tracker_(NULL), |
567 weak_factory_(this) { | 589 weak_factory_(this) { |
568 #if defined(ENABLE_PLUGINS) | 590 #if defined(ENABLE_PLUGINS) |
569 for (size_t i = 0; i < arraysize(kPredefinedAllowedDevChannelOrigins); ++i) | 591 for (size_t i = 0; i < arraysize(kPredefinedAllowedDevChannelOrigins); ++i) |
570 allowed_dev_channel_origins_.insert(kPredefinedAllowedDevChannelOrigins[i]); | 592 allowed_dev_channel_origins_.insert(kPredefinedAllowedDevChannelOrigins[i]); |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 | 831 |
810 host->Send(new ChromeViewMsg_SetIsIncognitoProcess( | 832 host->Send(new ChromeViewMsg_SetIsIncognitoProcess( |
811 profile->IsOffTheRecord())); | 833 profile->IsOffTheRecord())); |
812 | 834 |
813 for (size_t i = 0; i < extra_parts_.size(); ++i) | 835 for (size_t i = 0; i < extra_parts_.size(); ++i) |
814 extra_parts_[i]->RenderProcessWillLaunch(host); | 836 extra_parts_[i]->RenderProcessWillLaunch(host); |
815 | 837 |
816 RendererContentSettingRules rules; | 838 RendererContentSettingRules rules; |
817 if (host->IsIsolatedGuest()) { | 839 if (host->IsIsolatedGuest()) { |
818 #if defined(ENABLE_EXTENSIONS) | 840 #if defined(ENABLE_EXTENSIONS) |
819 GuestViewBase::GetDefaultContentSettingRules(&rules, | 841 GetGuestViewDefaultContentSettingRules(profile->IsOffTheRecord(), &rules); |
820 profile->IsOffTheRecord()); | |
821 #else | 842 #else |
822 NOTREACHED(); | 843 NOTREACHED(); |
823 #endif | 844 #endif |
824 } else { | 845 } else { |
825 GetRendererContentSettingRules( | 846 GetRendererContentSettingRules( |
826 profile->GetHostContentSettingsMap(), &rules); | 847 profile->GetHostContentSettingsMap(), &rules); |
827 } | 848 } |
828 host->Send(new ChromeViewMsg_SetContentSettingRules(rules)); | 849 host->Send(new ChromeViewMsg_SetContentSettingRules(rules)); |
829 } | 850 } |
830 | 851 |
(...skipping 1756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2587 switches::kDisableWebRtcEncryption, | 2608 switches::kDisableWebRtcEncryption, |
2588 }; | 2609 }; |
2589 to_command_line->CopySwitchesFrom(from_command_line, | 2610 to_command_line->CopySwitchesFrom(from_command_line, |
2590 kWebRtcDevSwitchNames, | 2611 kWebRtcDevSwitchNames, |
2591 arraysize(kWebRtcDevSwitchNames)); | 2612 arraysize(kWebRtcDevSwitchNames)); |
2592 } | 2613 } |
2593 } | 2614 } |
2594 #endif // defined(ENABLE_WEBRTC) | 2615 #endif // defined(ENABLE_WEBRTC) |
2595 | 2616 |
2596 } // namespace chrome | 2617 } // namespace chrome |
OLD | NEW |