diff options
author | snej@chromium.org <snej@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-03 23:06:51 +0000 |
---|---|---|
committer | snej@chromium.org <snej@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-03 23:06:51 +0000 |
commit | 89d6e6e3456280a12b4b806de8cbe3d049476df6 (patch) | |
tree | fe449cc80e3d1780c2db174d61836de639db0501 /chrome/browser/browser.cc | |
parent | 758338d7593c0b403ffde83b5490c9a19e47ddaa (diff) | |
download | chromium_src-89d6e6e3456280a12b4b806de8cbe3d049476df6.zip chromium_src-89d6e6e3456280a12b4b806de8cbe3d049476df6.tar.gz chromium_src-89d6e6e3456280a12b4b806de8cbe3d049476df6.tar.bz2 |
Implement "Email Link To Page" menu command.
This menu item only exists in the Mac build, but the code is cross-platform so it could be hooked up on other platforms as well, if desired.
It works by generating a URL of the form
mailto:?subject=Fwd:%20PAGETITLE&body=%0A%0APAGEURL
and telling platform_utils to open it.
This is my first patch involving command handling; I've tried to follow the way similar menu commands
like Print are implemented, but feel free to tell me if there are better ways.
I didn't find any place for unit tests for TabContents; if this needs tests, let me know where they should go.
BUG=29232
TEST=none
Review URL: http://codereview.chromium.org/466019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33746 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser.cc')
-rw-r--r-- | chrome/browser/browser.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index b9e6cb5..32cb834 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -1039,6 +1039,11 @@ void Browser::ClosePopups() { } #endif +void Browser::EmailPageLocation() { + UserMetrics::RecordAction("EmailPageLocation", profile_); + GetSelectedTabContents()->EmailPageLocation(); +} + void Browser::Print() { UserMetrics::RecordAction("PrintPreview", profile_); GetSelectedTabContents()->PrintPreview(); @@ -1464,6 +1469,7 @@ void Browser::ExecuteCommandWithDisposition( #if defined(OS_WIN) case IDC_CLOSE_POPUPS: ClosePopups(); break; #endif + case IDC_EMAIL_PAGE_LOCATION: EmailPageLocation(); break; case IDC_PRINT: Print(); break; case IDC_ENCODING_AUTO_DETECT: ToggleEncodingAutoDetect(); break; case IDC_ENCODING_UTF8: @@ -2385,6 +2391,7 @@ void Browser::InitCommandState() { // Page-related commands command_updater_.UpdateCommandEnabled(IDC_CLOSE_POPUPS, true); + command_updater_.UpdateCommandEnabled(IDC_EMAIL_PAGE_LOCATION, true); command_updater_.UpdateCommandEnabled(IDC_PRINT, true); command_updater_.UpdateCommandEnabled(IDC_ENCODING_AUTO_DETECT, true); command_updater_.UpdateCommandEnabled(IDC_ENCODING_UTF8, true); @@ -2549,6 +2556,8 @@ void Browser::UpdateCommandsForTabState() { // Show various bits of UI command_updater_.UpdateCommandEnabled(IDC_CREATE_SHORTCUTS, web_app::IsValidUrl(current_tab->GetURL())); + command_updater_.UpdateCommandEnabled(IDC_EMAIL_PAGE_LOCATION, + current_tab->ShouldDisplayURL() && current_tab->GetURL().is_valid()); } void Browser::UpdateStopGoState(bool is_loading, bool force) { |