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 18 matching lines...) Expand all Loading... | |
42 #include "chrome/browser/ui/search/search.h" | 44 #include "chrome/browser/ui/search/search.h" |
43 #include "chrome/browser/ui/search/search_model.h" | 45 #include "chrome/browser/ui/search/search_model.h" |
44 #include "chrome/browser/ui/status_bubble.h" | 46 #include "chrome/browser/ui/status_bubble.h" |
45 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 47 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
46 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 48 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
47 #include "chrome/browser/ui/webui/feedback_ui.h" | 49 #include "chrome/browser/ui/webui/feedback_ui.h" |
48 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" | 50 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" |
49 #include "chrome/browser/web_applications/web_app.h" | 51 #include "chrome/browser/web_applications/web_app.h" |
50 #include "chrome/common/chrome_switches.h" | 52 #include "chrome/common/chrome_switches.h" |
51 #include "chrome/common/pref_names.h" | 53 #include "chrome/common/pref_names.h" |
54 #include "content/public/browser/devtools_agent_host_registry.h" | |
52 #include "content/public/browser/navigation_controller.h" | 55 #include "content/public/browser/navigation_controller.h" |
53 #include "content/public/browser/navigation_entry.h" | 56 #include "content/public/browser/navigation_entry.h" |
54 #include "content/public/browser/page_navigator.h" | 57 #include "content/public/browser/page_navigator.h" |
55 #include "content/public/browser/render_view_host.h" | 58 #include "content/public/browser/render_view_host.h" |
56 #include "content/public/browser/user_metrics.h" | 59 #include "content/public/browser/user_metrics.h" |
57 #include "content/public/browser/web_contents.h" | 60 #include "content/public/browser/web_contents.h" |
58 #include "content/public/browser/web_contents_view.h" | 61 #include "content/public/browser/web_contents_view.h" |
59 #include "content/public/common/content_restriction.h" | 62 #include "content/public/common/content_restriction.h" |
60 #include "content/public/common/renderer_preferences.h" | 63 #include "content/public/common/renderer_preferences.h" |
61 #include "content/public/common/url_constants.h" | 64 #include "content/public/common/url_constants.h" |
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
842 } | 845 } |
843 | 846 |
844 void ToggleSpeechInput(Browser* browser) { | 847 void ToggleSpeechInput(Browser* browser) { |
845 GetActiveWebContents(browser)->GetRenderViewHost()->ToggleSpeechInput(); | 848 GetActiveWebContents(browser)->GetRenderViewHost()->ToggleSpeechInput(); |
846 } | 849 } |
847 | 850 |
848 void ToggleFullscreenMode(Browser* browser) { | 851 void ToggleFullscreenMode(Browser* browser) { |
849 browser->fullscreen_controller()->ToggleFullscreenMode(); | 852 browser->fullscreen_controller()->ToggleFullscreenMode(); |
850 } | 853 } |
851 | 854 |
855 void ClearCache(Browser* browser) { | |
856 BrowsingDataRemover* remover = new BrowsingDataRemover(browser->profile(), | |
857 BrowsingDataRemover::EVERYTHING, | |
858 base::Time()); | |
859 remover->Remove(BrowsingDataRemover::REMOVE_CACHE, | |
860 BrowsingDataHelper::UNPROTECTED_WEB); | |
861 // BrowsingDataRemover takes care of deleting itself when done. | |
862 } | |
863 | |
864 bool IsDebuggerAttachedToCurrentTab(Browser* browser) { | |
865 WebContents* contents = chrome::GetActiveWebContents(browser); | |
866 return contents != NULL ? | |
Ben Goodger (Google)
2012/07/11 16:14:32
contents ?
| |
867 content::DevToolsAgentHostRegistry::IsDebuggerAttached(contents) : false; | |
868 } | |
869 | |
852 void ViewSource(Browser* browser, TabContents* contents) { | 870 void ViewSource(Browser* browser, TabContents* contents) { |
853 DCHECK(contents); | 871 DCHECK(contents); |
854 | 872 |
855 NavigationEntry* active_entry = | 873 NavigationEntry* active_entry = |
856 contents->web_contents()->GetController().GetActiveEntry(); | 874 contents->web_contents()->GetController().GetActiveEntry(); |
857 if (!active_entry) | 875 if (!active_entry) |
858 return; | 876 return; |
859 | 877 |
860 ViewSource(browser, contents, active_entry->GetURL(), | 878 ViewSource(browser, contents, active_entry->GetURL(), |
861 active_entry->GetContentState()); | 879 active_entry->GetContentState()); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
955 if (!tab_contents) | 973 if (!tab_contents) |
956 tab_contents = new TabContents(contents); | 974 tab_contents = new TabContents(contents); |
957 app_browser->tab_strip_model()->AppendTabContents(tab_contents, true); | 975 app_browser->tab_strip_model()->AppendTabContents(tab_contents, true); |
958 | 976 |
959 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; | 977 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; |
960 contents->GetRenderViewHost()->SyncRendererPrefs(); | 978 contents->GetRenderViewHost()->SyncRendererPrefs(); |
961 app_browser->window()->Show(); | 979 app_browser->window()->Show(); |
962 } | 980 } |
963 | 981 |
964 } // namespace chrome | 982 } // namespace chrome |
OLD | NEW |