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 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
837 | 839 |
838 void OpenUpdateChromeDialog(Browser* browser) { | 840 void OpenUpdateChromeDialog(Browser* browser) { |
839 content::RecordAction(UserMetricsAction("UpdateChrome")); | 841 content::RecordAction(UserMetricsAction("UpdateChrome")); |
840 browser->window()->ShowUpdateChromeDialog(); | 842 browser->window()->ShowUpdateChromeDialog(); |
841 } | 843 } |
842 | 844 |
843 void ToggleSpeechInput(Browser* browser) { | 845 void ToggleSpeechInput(Browser* browser) { |
844 GetActiveWebContents(browser)->GetRenderViewHost()->ToggleSpeechInput(); | 846 GetActiveWebContents(browser)->GetRenderViewHost()->ToggleSpeechInput(); |
845 } | 847 } |
846 | 848 |
| 849 void ClearCache(Browser* browser) { |
| 850 BrowsingDataRemover* remover = new BrowsingDataRemover(browser->profile(), |
| 851 BrowsingDataRemover::EVERYTHING, |
| 852 base::Time()); |
| 853 remover->Remove(BrowsingDataRemover::REMOVE_CACHE, |
| 854 BrowsingDataHelper::UNPROTECTED_WEB); |
| 855 // BrowsingDataRemover takes care of deleting itself when done. |
| 856 } |
| 857 |
847 void ViewSource(Browser* browser, TabContents* contents) { | 858 void ViewSource(Browser* browser, TabContents* contents) { |
848 DCHECK(contents); | 859 DCHECK(contents); |
849 | 860 |
850 NavigationEntry* active_entry = | 861 NavigationEntry* active_entry = |
851 contents->web_contents()->GetController().GetActiveEntry(); | 862 contents->web_contents()->GetController().GetActiveEntry(); |
852 if (!active_entry) | 863 if (!active_entry) |
853 return; | 864 return; |
854 | 865 |
855 ViewSource(browser, contents, active_entry->GetURL(), | 866 ViewSource(browser, contents, active_entry->GetURL(), |
856 active_entry->GetContentState()); | 867 active_entry->GetContentState()); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
950 if (!tab_contents) | 961 if (!tab_contents) |
951 tab_contents = new TabContents(contents); | 962 tab_contents = new TabContents(contents); |
952 app_browser->tab_strip_model()->AppendTabContents(tab_contents, true); | 963 app_browser->tab_strip_model()->AppendTabContents(tab_contents, true); |
953 | 964 |
954 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; | 965 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; |
955 contents->GetRenderViewHost()->SyncRendererPrefs(); | 966 contents->GetRenderViewHost()->SyncRendererPrefs(); |
956 app_browser->window()->Show(); | 967 app_browser->window()->Show(); |
957 } | 968 } |
958 | 969 |
959 } // namespace chrome | 970 } // namespace chrome |
OLD | NEW |