| 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_commands.h" | 5 #include "chrome/browser/ui/browser_commands.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 11 #include "chrome/app/chrome_command_ids.h" | 11 #include "chrome/app/chrome_command_ids.h" |
| 12 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 12 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 14 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
| 15 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 15 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
| 16 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" | 16 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" |
| 17 #include "chrome/browser/chrome_notification_types.h" | 17 #include "chrome/browser/chrome_notification_types.h" |
| 18 #include "chrome/browser/devtools/devtools_window.h" | 18 #include "chrome/browser/devtools/devtools_window.h" |
| 19 #include "chrome/browser/dom_distiller/tab_utils.h" | 19 #include "chrome/browser/dom_distiller/tab_utils.h" |
| 20 #include "chrome/browser/lifetime/application_lifetime.h" | 20 #include "chrome/browser/lifetime/application_lifetime.h" |
| 21 #include "chrome/browser/media/router/media_router_feature.h" | 21 #include "chrome/browser/media/router/media_router_feature.h" |
| 22 #include "chrome/browser/platform_util.h" | 22 #include "chrome/browser/platform_util.h" |
| 23 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 23 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| 24 #include "chrome/browser/profiles/profile.h" | 24 #include "chrome/browser/profiles/profile.h" |
| 25 #include "chrome/browser/sessions/session_service_factory.h" | 25 #include "chrome/browser/sessions/session_service_factory.h" |
| 26 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 26 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
| 27 #include "chrome/browser/ssl/security_state_tab_helper.h" |
| 27 #include "chrome/browser/translate/chrome_translate_client.h" | 28 #include "chrome/browser/translate/chrome_translate_client.h" |
| 28 #include "chrome/browser/ui/accelerator_utils.h" | 29 #include "chrome/browser/ui/accelerator_utils.h" |
| 29 #include "chrome/browser/ui/autofill/save_card_bubble_controller_impl.h" | 30 #include "chrome/browser/ui/autofill/save_card_bubble_controller_impl.h" |
| 30 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" | 31 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" |
| 31 #include "chrome/browser/ui/bookmarks/bookmark_utils_desktop.h" | 32 #include "chrome/browser/ui/bookmarks/bookmark_utils_desktop.h" |
| 32 #include "chrome/browser/ui/browser.h" | 33 #include "chrome/browser/ui/browser.h" |
| 33 #include "chrome/browser/ui/browser_command_controller.h" | 34 #include "chrome/browser/ui/browser_command_controller.h" |
| 34 #include "chrome/browser/ui/browser_dialogs.h" | 35 #include "chrome/browser/ui/browser_dialogs.h" |
| 35 #include "chrome/browser/ui/browser_instant_controller.h" | 36 #include "chrome/browser/ui/browser_instant_controller.h" |
| 36 #include "chrome/browser/ui/browser_live_tab_context.h" | 37 #include "chrome/browser/ui/browser_live_tab_context.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 53 #include "chrome/browser/upgrade_detector.h" | 54 #include "chrome/browser/upgrade_detector.h" |
| 54 #include "chrome/common/content_restriction.h" | 55 #include "chrome/common/content_restriction.h" |
| 55 #include "chrome/common/features.h" | 56 #include "chrome/common/features.h" |
| 56 #include "chrome/common/pref_names.h" | 57 #include "chrome/common/pref_names.h" |
| 57 #include "components/bookmarks/browser/bookmark_model.h" | 58 #include "components/bookmarks/browser/bookmark_model.h" |
| 58 #include "components/bookmarks/browser/bookmark_utils.h" | 59 #include "components/bookmarks/browser/bookmark_utils.h" |
| 59 #include "components/bookmarks/common/bookmark_pref_names.h" | 60 #include "components/bookmarks/common/bookmark_pref_names.h" |
| 60 #include "components/favicon/content/content_favicon_driver.h" | 61 #include "components/favicon/content/content_favicon_driver.h" |
| 61 #include "components/google/core/browser/google_util.h" | 62 #include "components/google/core/browser/google_util.h" |
| 62 #include "components/prefs/pref_service.h" | 63 #include "components/prefs/pref_service.h" |
| 64 #include "components/security_state/core/security_state.h" |
| 63 #include "components/sessions/core/live_tab_context.h" | 65 #include "components/sessions/core/live_tab_context.h" |
| 64 #include "components/sessions/core/tab_restore_service.h" | 66 #include "components/sessions/core/tab_restore_service.h" |
| 65 #include "components/signin/core/browser/signin_header_helper.h" | 67 #include "components/signin/core/browser/signin_header_helper.h" |
| 66 #include "components/translate/core/browser/language_state.h" | 68 #include "components/translate/core/browser/language_state.h" |
| 67 #include "components/version_info/version_info.h" | 69 #include "components/version_info/version_info.h" |
| 68 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 70 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
| 69 #include "components/zoom/page_zoom.h" | 71 #include "components/zoom/page_zoom.h" |
| 70 #include "components/zoom/zoom_controller.h" | 72 #include "components/zoom/zoom_controller.h" |
| 71 #include "content/public/browser/devtools_agent_host.h" | 73 #include "content/public/browser/devtools_agent_host.h" |
| 72 #include "content/public/browser/navigation_controller.h" | 74 #include "content/public/browser/navigation_controller.h" |
| (...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 887 return false; | 889 return false; |
| 888 } | 890 } |
| 889 return !browser->is_devtools() && | 891 return !browser->is_devtools() && |
| 890 !(GetContentRestrictions(browser) & CONTENT_RESTRICTION_SAVE); | 892 !(GetContentRestrictions(browser) & CONTENT_RESTRICTION_SAVE); |
| 891 } | 893 } |
| 892 | 894 |
| 893 void ShowFindBar(Browser* browser) { | 895 void ShowFindBar(Browser* browser) { |
| 894 browser->GetFindBarController()->Show(); | 896 browser->GetFindBarController()->Show(); |
| 895 } | 897 } |
| 896 | 898 |
| 897 void ShowWebsiteSettings(Browser* browser, | 899 bool ShowWebsiteSettings(Browser* browser, content::WebContents* web_contents) { |
| 898 content::WebContents* web_contents, | 900 content::NavigationEntry* entry = |
| 899 const GURL& url, | 901 web_contents->GetController().GetVisibleEntry(); |
| 900 const security_state::SecurityInfo& security_info) { | 902 if (!entry) |
| 903 return false; |
| 904 |
| 905 SecurityStateTabHelper* helper = |
| 906 SecurityStateTabHelper::FromWebContents(web_contents); |
| 907 security_state::SecurityInfo security_info; |
| 908 helper->GetSecurityInfo(&security_info); |
| 909 |
| 901 browser->window()->ShowWebsiteSettings( | 910 browser->window()->ShowWebsiteSettings( |
| 902 Profile::FromBrowserContext(web_contents->GetBrowserContext()), | 911 Profile::FromBrowserContext(web_contents->GetBrowserContext()), |
| 903 web_contents, url, security_info); | 912 web_contents, entry->GetVirtualURL(), security_info); |
| 913 return true; |
| 904 } | 914 } |
| 905 | 915 |
| 906 void Print(Browser* browser) { | 916 void Print(Browser* browser) { |
| 907 #if BUILDFLAG(ENABLE_PRINTING) | 917 #if BUILDFLAG(ENABLE_PRINTING) |
| 908 auto* web_contents = browser->tab_strip_model()->GetActiveWebContents(); | 918 auto* web_contents = browser->tab_strip_model()->GetActiveWebContents(); |
| 909 printing::StartPrint(web_contents, browser->profile()->GetPrefs()->GetBoolean( | 919 printing::StartPrint(web_contents, browser->profile()->GetPrefs()->GetBoolean( |
| 910 prefs::kPrintPreviewDisabled), | 920 prefs::kPrintPreviewDisabled), |
| 911 false /* has_selection? */); | 921 false /* has_selection? */); |
| 912 #endif | 922 #endif |
| 913 } | 923 } |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1329 app_name, true /* trusted_source */, gfx::Rect(), browser->profile())); | 1339 app_name, true /* trusted_source */, gfx::Rect(), browser->profile())); |
| 1330 app_browser->tab_strip_model()->AppendWebContents(contents, true); | 1340 app_browser->tab_strip_model()->AppendWebContents(contents, true); |
| 1331 | 1341 |
| 1332 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; | 1342 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; |
| 1333 contents->GetRenderViewHost()->SyncRendererPrefs(); | 1343 contents->GetRenderViewHost()->SyncRendererPrefs(); |
| 1334 app_browser->window()->Show(); | 1344 app_browser->window()->Show(); |
| 1335 } | 1345 } |
| 1336 #endif // BUILDFLAG(ENABLE_EXTENSIONS) | 1346 #endif // BUILDFLAG(ENABLE_EXTENSIONS) |
| 1337 | 1347 |
| 1338 } // namespace chrome | 1348 } // namespace chrome |
| OLD | NEW |