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/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/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/bookmarks/bookmark_editor.h" | 10 #include "chrome/browser/bookmarks/bookmark_editor.h" |
11 #include "chrome/browser/bookmarks/bookmark_model.h" | 11 #include "chrome/browser/bookmarks/bookmark_model.h" |
12 #include "chrome/browser/bookmarks/bookmark_utils.h" | 12 #include "chrome/browser/bookmarks/bookmark_utils.h" |
13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/browsing_data_helper.h" |
| 15 #include "chrome/browser/browsing_data_remover.h" |
14 #include "chrome/browser/chrome_page_zoom.h" | 16 #include "chrome/browser/chrome_page_zoom.h" |
15 #include "chrome/browser/debugger/devtools_window.h" | 17 #include "chrome/browser/debugger/devtools_window.h" |
16 #include "chrome/browser/download/download_util.h" | 18 #include "chrome/browser/download/download_util.h" |
17 #include "chrome/browser/extensions/extension_service.h" | 19 #include "chrome/browser/extensions/extension_service.h" |
18 #include "chrome/browser/extensions/extension_tab_helper.h" | 20 #include "chrome/browser/extensions/extension_tab_helper.h" |
19 #include "chrome/browser/favicon/favicon_tab_helper.h" | 21 #include "chrome/browser/favicon/favicon_tab_helper.h" |
20 #include "chrome/browser/lifetime/application_lifetime.h" | 22 #include "chrome/browser/lifetime/application_lifetime.h" |
21 #include "chrome/browser/platform_util.h" | 23 #include "chrome/browser/platform_util.h" |
22 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 24 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
23 #include "chrome/browser/prefs/pref_service.h" | 25 #include "chrome/browser/prefs/pref_service.h" |
(...skipping 19 matching lines...) Expand all Loading... |
43 #include "chrome/browser/ui/search/search.h" | 45 #include "chrome/browser/ui/search/search.h" |
44 #include "chrome/browser/ui/search/search_model.h" | 46 #include "chrome/browser/ui/search/search_model.h" |
45 #include "chrome/browser/ui/status_bubble.h" | 47 #include "chrome/browser/ui/status_bubble.h" |
46 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 48 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
47 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 49 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
48 #include "chrome/browser/ui/webui/feedback_ui.h" | 50 #include "chrome/browser/ui/webui/feedback_ui.h" |
49 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" | 51 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" |
50 #include "chrome/browser/web_applications/web_app.h" | 52 #include "chrome/browser/web_applications/web_app.h" |
51 #include "chrome/common/chrome_switches.h" | 53 #include "chrome/common/chrome_switches.h" |
52 #include "chrome/common/pref_names.h" | 54 #include "chrome/common/pref_names.h" |
| 55 #include "content/public/browser/devtools_agent_host_registry.h" |
53 #include "content/public/browser/navigation_controller.h" | 56 #include "content/public/browser/navigation_controller.h" |
54 #include "content/public/browser/navigation_entry.h" | 57 #include "content/public/browser/navigation_entry.h" |
55 #include "content/public/browser/page_navigator.h" | 58 #include "content/public/browser/page_navigator.h" |
56 #include "content/public/browser/render_view_host.h" | 59 #include "content/public/browser/render_view_host.h" |
57 #include "content/public/browser/user_metrics.h" | 60 #include "content/public/browser/user_metrics.h" |
58 #include "content/public/browser/web_contents.h" | 61 #include "content/public/browser/web_contents.h" |
59 #include "content/public/browser/web_contents_view.h" | 62 #include "content/public/browser/web_contents_view.h" |
60 #include "content/public/common/content_restriction.h" | 63 #include "content/public/common/content_restriction.h" |
61 #include "content/public/common/renderer_preferences.h" | 64 #include "content/public/common/renderer_preferences.h" |
62 #include "content/public/common/url_constants.h" | 65 #include "content/public/common/url_constants.h" |
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 } | 902 } |
900 | 903 |
901 void ToggleSpeechInput(Browser* browser) { | 904 void ToggleSpeechInput(Browser* browser) { |
902 GetActiveWebContents(browser)->GetRenderViewHost()->ToggleSpeechInput(); | 905 GetActiveWebContents(browser)->GetRenderViewHost()->ToggleSpeechInput(); |
903 } | 906 } |
904 | 907 |
905 void ToggleFullscreenMode(Browser* browser) { | 908 void ToggleFullscreenMode(Browser* browser) { |
906 browser->fullscreen_controller()->ToggleFullscreenMode(); | 909 browser->fullscreen_controller()->ToggleFullscreenMode(); |
907 } | 910 } |
908 | 911 |
| 912 void ClearCache(Browser* browser) { |
| 913 BrowsingDataRemover* remover = new BrowsingDataRemover(browser->profile(), |
| 914 BrowsingDataRemover::EVERYTHING, |
| 915 base::Time()); |
| 916 remover->Remove(BrowsingDataRemover::REMOVE_CACHE, |
| 917 BrowsingDataHelper::UNPROTECTED_WEB); |
| 918 // BrowsingDataRemover takes care of deleting itself when done. |
| 919 } |
| 920 |
| 921 bool IsDebuggerAttachedToCurrentTab(Browser* browser) { |
| 922 WebContents* contents = chrome::GetActiveWebContents(browser); |
| 923 return contents ? |
| 924 content::DevToolsAgentHostRegistry::IsDebuggerAttached(contents) : false; |
| 925 } |
| 926 |
909 void ViewSource(Browser* browser, TabContents* contents) { | 927 void ViewSource(Browser* browser, TabContents* contents) { |
910 DCHECK(contents); | 928 DCHECK(contents); |
911 | 929 |
912 NavigationEntry* active_entry = | 930 NavigationEntry* active_entry = |
913 contents->web_contents()->GetController().GetActiveEntry(); | 931 contents->web_contents()->GetController().GetActiveEntry(); |
914 if (!active_entry) | 932 if (!active_entry) |
915 return; | 933 return; |
916 | 934 |
917 ViewSource(browser, contents, active_entry->GetURL(), | 935 ViewSource(browser, contents, active_entry->GetURL(), |
918 active_entry->GetContentState()); | 936 active_entry->GetContentState()); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1012 if (!tab_contents) | 1030 if (!tab_contents) |
1013 tab_contents = new TabContents(contents); | 1031 tab_contents = new TabContents(contents); |
1014 app_browser->tab_strip_model()->AppendTabContents(tab_contents, true); | 1032 app_browser->tab_strip_model()->AppendTabContents(tab_contents, true); |
1015 | 1033 |
1016 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; | 1034 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; |
1017 contents->GetRenderViewHost()->SyncRendererPrefs(); | 1035 contents->GetRenderViewHost()->SyncRendererPrefs(); |
1018 app_browser->window()->Show(); | 1036 app_browser->window()->Show(); |
1019 } | 1037 } |
1020 | 1038 |
1021 } // namespace chrome | 1039 } // namespace chrome |
OLD | NEW |