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.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 #include "content/public/browser/user_metrics.h" | 77 #include "content/public/browser/user_metrics.h" |
78 #include "content/public/browser/web_contents.h" | 78 #include "content/public/browser/web_contents.h" |
79 #include "content/public/common/page_state.h" | 79 #include "content/public/common/page_state.h" |
80 #include "content/public/common/renderer_preferences.h" | 80 #include "content/public/common/renderer_preferences.h" |
81 #include "content/public/common/url_constants.h" | 81 #include "content/public/common/url_constants.h" |
82 #include "content/public/common/url_utils.h" | 82 #include "content/public/common/url_utils.h" |
83 #include "content/public/common/user_agent.h" | 83 #include "content/public/common/user_agent.h" |
84 #include "net/base/escape.h" | 84 #include "net/base/escape.h" |
85 #include "ui/events/keycodes/keyboard_codes.h" | 85 #include "ui/events/keycodes/keyboard_codes.h" |
86 | 86 |
87 #if defined(OS_WIN) | |
88 #include "chrome/browser/ui/metro_pin_tab_helper_win.h" | |
89 #endif | |
90 | |
91 #if defined(ENABLE_EXTENSIONS) | 87 #if defined(ENABLE_EXTENSIONS) |
92 #include "chrome/browser/extensions/api/commands/command_service.h" | 88 #include "chrome/browser/extensions/api/commands/command_service.h" |
93 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" | 89 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" |
94 #include "chrome/browser/extensions/tab_helper.h" | 90 #include "chrome/browser/extensions/tab_helper.h" |
95 #include "chrome/browser/web_applications/web_app.h" | 91 #include "chrome/browser/web_applications/web_app.h" |
96 #include "chrome/common/extensions/extension_metrics.h" | 92 #include "chrome/common/extensions/extension_metrics.h" |
97 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" | 93 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" |
98 #include "extensions/browser/extension_registry.h" | 94 #include "extensions/browser/extension_registry.h" |
99 #include "extensions/browser/extension_system.h" | 95 #include "extensions/browser/extension_system.h" |
100 #include "extensions/common/extension.h" | 96 #include "extensions/common/extension.h" |
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 | 836 |
841 void ManagePasswordsForPage(Browser* browser) { | 837 void ManagePasswordsForPage(Browser* browser) { |
842 WebContents* web_contents = | 838 WebContents* web_contents = |
843 browser->tab_strip_model()->GetActiveWebContents(); | 839 browser->tab_strip_model()->GetActiveWebContents(); |
844 ManagePasswordsUIController* controller = | 840 ManagePasswordsUIController* controller = |
845 ManagePasswordsUIController::FromWebContents(web_contents); | 841 ManagePasswordsUIController::FromWebContents(web_contents); |
846 TabDialogs::FromWebContents(web_contents)->ShowManagePasswordsBubble( | 842 TabDialogs::FromWebContents(web_contents)->ShowManagePasswordsBubble( |
847 !controller->IsAutomaticallyOpeningBubble()); | 843 !controller->IsAutomaticallyOpeningBubble()); |
848 } | 844 } |
849 | 845 |
850 #if defined(OS_WIN) | |
851 void TogglePagePinnedToStartScreen(Browser* browser) { | |
852 MetroPinTabHelper::FromWebContents( | |
853 browser->tab_strip_model()->GetActiveWebContents())-> | |
854 TogglePinnedToStartScreen(); | |
855 } | |
856 #endif | |
857 | |
858 void SavePage(Browser* browser) { | 846 void SavePage(Browser* browser) { |
859 content::RecordAction(UserMetricsAction("SavePage")); | 847 content::RecordAction(UserMetricsAction("SavePage")); |
860 WebContents* current_tab = browser->tab_strip_model()->GetActiveWebContents(); | 848 WebContents* current_tab = browser->tab_strip_model()->GetActiveWebContents(); |
861 if (current_tab && current_tab->GetContentsMimeType() == "application/pdf") | 849 if (current_tab && current_tab->GetContentsMimeType() == "application/pdf") |
862 content::RecordAction(UserMetricsAction("PDF.SavePage")); | 850 content::RecordAction(UserMetricsAction("PDF.SavePage")); |
863 current_tab->OnSavePage(); | 851 current_tab->OnSavePage(); |
864 } | 852 } |
865 | 853 |
866 bool CanSavePage(const Browser* browser) { | 854 bool CanSavePage(const Browser* browser) { |
867 // LocalState can be NULL in tests. | 855 // LocalState can be NULL in tests. |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1319 browser->host_desktop_type())); | 1307 browser->host_desktop_type())); |
1320 app_browser->tab_strip_model()->AppendWebContents(contents, true); | 1308 app_browser->tab_strip_model()->AppendWebContents(contents, true); |
1321 | 1309 |
1322 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; | 1310 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; |
1323 contents->GetRenderViewHost()->SyncRendererPrefs(); | 1311 contents->GetRenderViewHost()->SyncRendererPrefs(); |
1324 app_browser->window()->Show(); | 1312 app_browser->window()->Show(); |
1325 } | 1313 } |
1326 #endif // defined(ENABLE_EXTENSIONS) | 1314 #endif // defined(ENABLE_EXTENSIONS) |
1327 | 1315 |
1328 } // namespace chrome | 1316 } // namespace chrome |
OLD | NEW |