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.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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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" |
152 #include "chrome/common/search/search_types.h" | 153 #include "chrome/common/search/search_types.h" |
| 154 #include "chrome/common/ssl_insecure_content.h" |
153 #include "chrome/common/url_constants.h" | 155 #include "chrome/common/url_constants.h" |
154 #include "chrome/grit/chromium_strings.h" | 156 #include "chrome/grit/chromium_strings.h" |
155 #include "chrome/grit/generated_resources.h" | 157 #include "chrome/grit/generated_resources.h" |
156 #include "chrome/grit/locale_settings.h" | 158 #include "chrome/grit/locale_settings.h" |
157 #include "components/bookmarks/browser/bookmark_model.h" | 159 #include "components/bookmarks/browser/bookmark_model.h" |
158 #include "components/bookmarks/browser/bookmark_utils.h" | 160 #include "components/bookmarks/browser/bookmark_utils.h" |
159 #include "components/bookmarks/common/bookmark_pref_names.h" | 161 #include "components/bookmarks/common/bookmark_pref_names.h" |
160 #include "components/browser_sync/profile_sync_service.h" | 162 #include "components/browser_sync/profile_sync_service.h" |
161 #include "components/bubble/bubble_controller.h" | 163 #include "components/bubble/bubble_controller.h" |
162 #include "components/content_settings/core/browser/host_content_settings_map.h" | 164 #include "components/content_settings/core/browser/host_content_settings_map.h" |
(...skipping 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1323 return std::move(bluetooth_chooser_desktop); | 1325 return std::move(bluetooth_chooser_desktop); |
1324 } | 1326 } |
1325 | 1327 |
1326 void Browser::RequestAppBannerFromDevTools(content::WebContents* web_contents) { | 1328 void Browser::RequestAppBannerFromDevTools(content::WebContents* web_contents) { |
1327 banners::AppBannerManagerDesktop::CreateForWebContents(web_contents); | 1329 banners::AppBannerManagerDesktop::CreateForWebContents(web_contents); |
1328 banners::AppBannerManagerDesktop* manager = | 1330 banners::AppBannerManagerDesktop* manager = |
1329 banners::AppBannerManagerDesktop::FromWebContents(web_contents); | 1331 banners::AppBannerManagerDesktop::FromWebContents(web_contents); |
1330 manager->RequestAppBanner(web_contents->GetLastCommittedURL(), true); | 1332 manager->RequestAppBanner(web_contents->GetLastCommittedURL(), true); |
1331 } | 1333 } |
1332 | 1334 |
| 1335 void Browser::PassiveInsecureContentFound(const GURL& resource_url) { |
| 1336 // Note: this implementation is a mirror of |
| 1337 // ContentSettingsObserver::passiveInsecureContentFound |
| 1338 ReportInsecureContent(SslInsecureContentType::DISPLAY); |
| 1339 FilteredReportInsecureContentDisplayed(resource_url); |
| 1340 } |
| 1341 |
| 1342 bool Browser::ShouldAllowRunningInsecureContent( |
| 1343 bool allowed_per_settings, |
| 1344 const url::Origin& origin, |
| 1345 const GURL& resource_url, |
| 1346 content::WebContents* web_contents) { |
| 1347 // Note: this implementation is a mirror of |
| 1348 // ContentSettingsObserver::allowRunningInsecureContent. |
| 1349 FilteredReportInsecureContentRan(resource_url); |
| 1350 |
| 1351 MixedContentSettings* mixed_content_settings = |
| 1352 MixedContentSettings::FromWebContents(web_contents); |
| 1353 DCHECK(mixed_content_settings); |
| 1354 if (allowed_per_settings || |
| 1355 mixed_content_settings->insecure_content_allowed_running()) { |
| 1356 return true; |
| 1357 } |
| 1358 |
| 1359 // Note: this is a browser-side-translation of the call to DidBlockContentType |
| 1360 // from inside ContentSettingsObserver::allowRunningInsecureContent. |
| 1361 if (!origin.host().empty()) { |
| 1362 TabSpecificContentSettings* tab_settings = |
| 1363 TabSpecificContentSettings::FromWebContents(web_contents); |
| 1364 DCHECK(tab_settings); |
| 1365 tab_settings->OnContentBlockedWithDetail(CONTENT_SETTINGS_TYPE_MIXEDSCRIPT, |
| 1366 base::UTF8ToUTF16(origin.host())); |
| 1367 } |
| 1368 return false; |
| 1369 } |
| 1370 |
1333 bool Browser::IsMouseLocked() const { | 1371 bool Browser::IsMouseLocked() const { |
1334 return exclusive_access_manager_->mouse_lock_controller()->IsMouseLocked(); | 1372 return exclusive_access_manager_->mouse_lock_controller()->IsMouseLocked(); |
1335 } | 1373 } |
1336 | 1374 |
1337 void Browser::OnWindowDidShow() { | 1375 void Browser::OnWindowDidShow() { |
1338 if (window_has_shown_) | 1376 if (window_has_shown_) |
1339 return; | 1377 return; |
1340 window_has_shown_ = true; | 1378 window_has_shown_ = true; |
1341 | 1379 |
1342 startup_metric_utils::RecordBrowserWindowDisplay(base::TimeTicks::Now()); | 1380 startup_metric_utils::RecordBrowserWindowDisplay(base::TimeTicks::Now()); |
(...skipping 1237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2580 // new window later, thus we need to navigate the window now. | 2618 // new window later, thus we need to navigate the window now. |
2581 if (contents) { | 2619 if (contents) { |
2582 contents->web_contents()->GetController().LoadURL( | 2620 contents->web_contents()->GetController().LoadURL( |
2583 target_url, content::Referrer(), ui::PAGE_TRANSITION_LINK, | 2621 target_url, content::Referrer(), ui::PAGE_TRANSITION_LINK, |
2584 std::string()); // No extra headers. | 2622 std::string()); // No extra headers. |
2585 } | 2623 } |
2586 } | 2624 } |
2587 | 2625 |
2588 return contents != NULL; | 2626 return contents != NULL; |
2589 } | 2627 } |
OLD | NEW |