| 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 900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 911 std::string mailto = std::string("mailto:?subject=Fwd:%20") + | 911 std::string mailto = std::string("mailto:?subject=Fwd:%20") + |
| 912 title + "&body=%0A%0A" + page_url; | 912 title + "&body=%0A%0A" + page_url; |
| 913 platform_util::OpenExternal(browser->profile(), GURL(mailto)); | 913 platform_util::OpenExternal(browser->profile(), GURL(mailto)); |
| 914 } | 914 } |
| 915 | 915 |
| 916 bool CanEmailPageLocation(const Browser* browser) { | 916 bool CanEmailPageLocation(const Browser* browser) { |
| 917 return browser->toolbar_model()->ShouldDisplayURL() && | 917 return browser->toolbar_model()->ShouldDisplayURL() && |
| 918 browser->tab_strip_model()->GetActiveWebContents()->GetURL().is_valid(); | 918 browser->tab_strip_model()->GetActiveWebContents()->GetURL().is_valid(); |
| 919 } | 919 } |
| 920 | 920 |
| 921 void Cut(Browser* browser) { | 921 void CutCopyPaste(Browser* browser, int command_id) { |
| 922 content::RecordAction(UserMetricsAction("Cut")); | 922 if (command_id == IDC_CUT) |
| 923 browser->window()->Cut(); | 923 content::RecordAction(UserMetricsAction("Cut")); |
| 924 } | 924 else if (command_id == IDC_COPY) |
| 925 | 925 content::RecordAction(UserMetricsAction("Copy")); |
| 926 void Copy(Browser* browser) { | 926 else |
| 927 content::RecordAction(UserMetricsAction("Copy")); | 927 content::RecordAction(UserMetricsAction("Paste")); |
| 928 browser->window()->Copy(); | 928 browser->window()->CutCopyPaste(command_id); |
| 929 } | |
| 930 | |
| 931 void Paste(Browser* browser) { | |
| 932 content::RecordAction(UserMetricsAction("Paste")); | |
| 933 browser->window()->Paste(); | |
| 934 } | 929 } |
| 935 | 930 |
| 936 void Find(Browser* browser) { | 931 void Find(Browser* browser) { |
| 937 content::RecordAction(UserMetricsAction("Find")); | 932 content::RecordAction(UserMetricsAction("Find")); |
| 938 FindInPage(browser, false, false); | 933 FindInPage(browser, false, false); |
| 939 } | 934 } |
| 940 | 935 |
| 941 void FindNext(Browser* browser) { | 936 void FindNext(Browser* browser) { |
| 942 content::RecordAction(UserMetricsAction("FindNext")); | 937 content::RecordAction(UserMetricsAction("FindNext")); |
| 943 FindInPage(browser, true, true); | 938 FindInPage(browser, true, true); |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1280 browser->host_desktop_type())); | 1275 browser->host_desktop_type())); |
| 1281 app_browser->tab_strip_model()->AppendWebContents(contents, true); | 1276 app_browser->tab_strip_model()->AppendWebContents(contents, true); |
| 1282 | 1277 |
| 1283 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; | 1278 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; |
| 1284 contents->GetRenderViewHost()->SyncRendererPrefs(); | 1279 contents->GetRenderViewHost()->SyncRendererPrefs(); |
| 1285 app_browser->window()->Show(); | 1280 app_browser->window()->Show(); |
| 1286 } | 1281 } |
| 1287 #endif // defined(ENABLE_EXTENSIONS) | 1282 #endif // defined(ENABLE_EXTENSIONS) |
| 1288 | 1283 |
| 1289 } // namespace chrome | 1284 } // namespace chrome |
| OLD | NEW |