OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/ui/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <string> | 10 #include <string> |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "chrome/app/chrome_command_ids.h" | 31 #include "chrome/app/chrome_command_ids.h" |
32 #include "chrome/browser/app_mode/app_mode_utils.h" | 32 #include "chrome/browser/app_mode/app_mode_utils.h" |
33 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 33 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
34 #include "chrome/browser/background/background_contents.h" | 34 #include "chrome/browser/background/background_contents.h" |
35 #include "chrome/browser/background/background_contents_service.h" | 35 #include "chrome/browser/background/background_contents_service.h" |
36 #include "chrome/browser/background/background_contents_service_factory.h" | 36 #include "chrome/browser/background/background_contents_service_factory.h" |
37 #include "chrome/browser/banners/app_banner_manager_desktop.h" | 37 #include "chrome/browser/banners/app_banner_manager_desktop.h" |
38 #include "chrome/browser/browser_process.h" | 38 #include "chrome/browser/browser_process.h" |
39 #include "chrome/browser/browser_shutdown.h" | 39 #include "chrome/browser/browser_shutdown.h" |
40 #include "chrome/browser/chrome_notification_types.h" | 40 #include "chrome/browser/chrome_notification_types.h" |
| 41 #include "chrome/browser/content_settings/mixed_content_settings_tab_helper.h" |
41 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 42 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
42 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 43 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
43 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" | 44 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" |
44 #include "chrome/browser/custom_handlers/register_protocol_handler_permission_re
quest.h" | 45 #include "chrome/browser/custom_handlers/register_protocol_handler_permission_re
quest.h" |
45 #include "chrome/browser/defaults.h" | 46 #include "chrome/browser/defaults.h" |
46 #include "chrome/browser/devtools/devtools_toggle_action.h" | 47 #include "chrome/browser/devtools/devtools_toggle_action.h" |
47 #include "chrome/browser/devtools/devtools_window.h" | 48 #include "chrome/browser/devtools/devtools_window.h" |
48 #include "chrome/browser/download/download_service.h" | 49 #include "chrome/browser/download/download_service.h" |
49 #include "chrome/browser/download/download_service_factory.h" | 50 #include "chrome/browser/download/download_service_factory.h" |
50 #include "chrome/browser/extensions/api/tabs/tabs_event_router.h" | 51 #include "chrome/browser/extensions/api/tabs/tabs_event_router.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 #include "chrome/browser/ui/website_settings/chooser_bubble_delegate.h" | 143 #include "chrome/browser/ui/website_settings/chooser_bubble_delegate.h" |
143 #include "chrome/browser/ui/webui/signin/login_ui_service.h" | 144 #include "chrome/browser/ui/webui/signin/login_ui_service.h" |
144 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" | 145 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
145 #include "chrome/browser/ui/window_sizer/window_sizer.h" | 146 #include "chrome/browser/ui/window_sizer/window_sizer.h" |
146 #include "chrome/browser/upgrade_detector.h" | 147 #include "chrome/browser/upgrade_detector.h" |
147 #include "chrome/common/chrome_constants.h" | 148 #include "chrome/common/chrome_constants.h" |
148 #include "chrome/common/chrome_switches.h" | 149 #include "chrome/common/chrome_switches.h" |
149 #include "chrome/common/custom_handlers/protocol_handler.h" | 150 #include "chrome/common/custom_handlers/protocol_handler.h" |
150 #include "chrome/common/pref_names.h" | 151 #include "chrome/common/pref_names.h" |
151 #include "chrome/common/profiling.h" | 152 #include "chrome/common/profiling.h" |
| 153 #include "chrome/common/ssl_insecure_content.h" |
152 #include "chrome/common/url_constants.h" | 154 #include "chrome/common/url_constants.h" |
153 #include "chrome/grit/chromium_strings.h" | 155 #include "chrome/grit/chromium_strings.h" |
154 #include "chrome/grit/generated_resources.h" | 156 #include "chrome/grit/generated_resources.h" |
155 #include "chrome/grit/locale_settings.h" | 157 #include "chrome/grit/locale_settings.h" |
156 #include "components/bookmarks/browser/bookmark_model.h" | 158 #include "components/bookmarks/browser/bookmark_model.h" |
157 #include "components/bookmarks/browser/bookmark_utils.h" | 159 #include "components/bookmarks/browser/bookmark_utils.h" |
158 #include "components/bookmarks/common/bookmark_pref_names.h" | 160 #include "components/bookmarks/common/bookmark_pref_names.h" |
159 #include "components/browser_sync/profile_sync_service.h" | 161 #include "components/browser_sync/profile_sync_service.h" |
160 #include "components/bubble/bubble_controller.h" | 162 #include "components/bubble/bubble_controller.h" |
161 #include "components/content_settings/core/browser/host_content_settings_map.h" | 163 #include "components/content_settings/core/browser/host_content_settings_map.h" |
(...skipping 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1340 return std::move(bluetooth_chooser_desktop); | 1342 return std::move(bluetooth_chooser_desktop); |
1341 } | 1343 } |
1342 | 1344 |
1343 void Browser::RequestAppBannerFromDevTools(content::WebContents* web_contents) { | 1345 void Browser::RequestAppBannerFromDevTools(content::WebContents* web_contents) { |
1344 banners::AppBannerManagerDesktop::CreateForWebContents(web_contents); | 1346 banners::AppBannerManagerDesktop::CreateForWebContents(web_contents); |
1345 banners::AppBannerManagerDesktop* manager = | 1347 banners::AppBannerManagerDesktop* manager = |
1346 banners::AppBannerManagerDesktop::FromWebContents(web_contents); | 1348 banners::AppBannerManagerDesktop::FromWebContents(web_contents); |
1347 manager->RequestAppBanner(web_contents->GetLastCommittedURL(), true); | 1349 manager->RequestAppBanner(web_contents->GetLastCommittedURL(), true); |
1348 } | 1350 } |
1349 | 1351 |
| 1352 void Browser::PassiveInsecureContentFound(const GURL& resource_url) { |
| 1353 // Note: this implementation is a mirror of |
| 1354 // ContentSettingsObserver::passiveInsecureContentFound |
| 1355 ReportInsecureContent(SslInsecureContentType::DISPLAY); |
| 1356 FilteredReportInsecureContentDisplayed(resource_url); |
| 1357 } |
| 1358 |
| 1359 bool Browser::ShouldAllowRunningInsecureContent( |
| 1360 content::WebContents* web_contents, |
| 1361 bool allowed_per_prefs, |
| 1362 const url::Origin& origin, |
| 1363 const GURL& resource_url) { |
| 1364 // Note: this implementation is a mirror of |
| 1365 // ContentSettingsObserver::allowRunningInsecureContent. |
| 1366 FilteredReportInsecureContentRan(resource_url); |
| 1367 |
| 1368 MixedContentSettingsTabHelper* mixed_content_settings = |
| 1369 MixedContentSettingsTabHelper::FromWebContents(web_contents); |
| 1370 DCHECK(mixed_content_settings); |
| 1371 if (allowed_per_prefs || |
| 1372 mixed_content_settings->is_running_insecure_content_allowed()) { |
| 1373 return true; |
| 1374 } |
| 1375 |
| 1376 // Note: this is a browser-side-translation of the call to DidBlockContentType |
| 1377 // from inside ContentSettingsObserver::allowRunningInsecureContent. |
| 1378 if (!origin.host().empty()) { |
| 1379 TabSpecificContentSettings* tab_settings = |
| 1380 TabSpecificContentSettings::FromWebContents(web_contents); |
| 1381 DCHECK(tab_settings); |
| 1382 tab_settings->OnContentBlockedWithDetail(CONTENT_SETTINGS_TYPE_MIXEDSCRIPT, |
| 1383 base::UTF8ToUTF16(origin.host())); |
| 1384 } |
| 1385 return false; |
| 1386 } |
| 1387 |
1350 bool Browser::IsMouseLocked() const { | 1388 bool Browser::IsMouseLocked() const { |
1351 return exclusive_access_manager_->mouse_lock_controller()->IsMouseLocked(); | 1389 return exclusive_access_manager_->mouse_lock_controller()->IsMouseLocked(); |
1352 } | 1390 } |
1353 | 1391 |
1354 void Browser::OnWindowDidShow() { | 1392 void Browser::OnWindowDidShow() { |
1355 if (window_has_shown_) | 1393 if (window_has_shown_) |
1356 return; | 1394 return; |
1357 window_has_shown_ = true; | 1395 window_has_shown_ = true; |
1358 | 1396 |
1359 startup_metric_utils::RecordBrowserWindowDisplay(base::TimeTicks::Now()); | 1397 startup_metric_utils::RecordBrowserWindowDisplay(base::TimeTicks::Now()); |
(...skipping 1260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2620 // new window later, thus we need to navigate the window now. | 2658 // new window later, thus we need to navigate the window now. |
2621 if (contents) { | 2659 if (contents) { |
2622 contents->web_contents()->GetController().LoadURL( | 2660 contents->web_contents()->GetController().LoadURL( |
2623 target_url, content::Referrer(), ui::PAGE_TRANSITION_LINK, | 2661 target_url, content::Referrer(), ui::PAGE_TRANSITION_LINK, |
2624 std::string()); // No extra headers. | 2662 std::string()); // No extra headers. |
2625 } | 2663 } |
2626 } | 2664 } |
2627 | 2665 |
2628 return contents != NULL; | 2666 return contents != NULL; |
2629 } | 2667 } |
OLD | NEW |