diff options
-rw-r--r-- | chrome/app/chrome_dll_resource.h | 1 | ||||
-rw-r--r-- | chrome/app/nibs/MainMenu.xib | 22 | ||||
-rw-r--r-- | chrome/browser/browser.cc | 9 | ||||
-rw-r--r-- | chrome/browser/browser.h | 1 | ||||
-rw-r--r-- | chrome/browser/tab_contents/tab_contents.cc | 9 | ||||
-rw-r--r-- | chrome/browser/tab_contents/tab_contents.h | 4 | ||||
-rw-r--r-- | chrome/common/platform_util_mac.mm | 11 | ||||
-rw-r--r-- | net/base/escape.cc | 4 | ||||
-rw-r--r-- | net/base/escape.h | 2 |
9 files changed, 53 insertions, 10 deletions
diff --git a/chrome/app/chrome_dll_resource.h b/chrome/app/chrome_dll_resource.h index 4aee050..180f136 100644 --- a/chrome/app/chrome_dll_resource.h +++ b/chrome/app/chrome_dll_resource.h @@ -117,6 +117,7 @@ #define IDC_PRINT 35004 #define IDC_SAVE_PAGE 35005 #define IDC_ENCODING_MENU 35006 +#define IDC_EMAIL_PAGE_LOCATION 35007 // When adding a new encoding to this list, be sure to append it to the // EncodingMenuController::kValidEncodingIds array in diff --git a/chrome/app/nibs/MainMenu.xib b/chrome/app/nibs/MainMenu.xib index ca2bea1..bb33b2a 100644 --- a/chrome/app/nibs/MainMenu.xib +++ b/chrome/app/nibs/MainMenu.xib @@ -2,13 +2,13 @@ <archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.03"> <data> <int key="IBDocument.SystemTarget">1050</int> - <string key="IBDocument.SystemVersion">9L30</string> - <string key="IBDocument.InterfaceBuilderVersion">680</string> + <string key="IBDocument.SystemVersion">9L31a</string> + <string key="IBDocument.InterfaceBuilderVersion">677</string> <string key="IBDocument.AppKitVersion">949.54</string> <string key="IBDocument.HIToolboxVersion">353.00</string> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="57"/> + <integer value="451"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -362,10 +362,12 @@ <object class="NSMenuItem" id="120844338"> <reference key="NSMenu" ref="720053764"/> <string key="NSTitle">^IDS_EMAIL_PAGE_LOCATION_MAC</string> - <string key="NSKeyEquiv"/> + <string key="NSKeyEquiv">I</string> + <int key="NSKeyEquivModMask">1048576</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="353210768"/> <reference key="NSMixedImage" ref="549394948"/> + <int key="NSTag">35007</int> </object> <object class="NSMenuItem" id="1010469920"> <reference key="NSMenu" ref="720053764"/> @@ -1669,6 +1671,14 @@ </object> <int key="connectionID">667</int> </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">commandDispatch:</string> + <reference key="source" ref="1014"/> + <reference key="destination" ref="120844338"/> + </object> + <int key="connectionID">668</int> + </object> </object> <object class="IBMutableOrderedSet" key="objectRecords"> <object class="NSArray" key="orderedObjects"> @@ -2920,7 +2930,7 @@ <reference ref="9"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> - <string>{{305, 468}, {353, 303}}</string> + <string>{{648, 422}, {353, 303}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> <string>{{323, 672}, {199, 203}}</string> @@ -2952,7 +2962,7 @@ </object> </object> <nil key="sourceID"/> - <int key="maxID">667</int> + <int key="maxID">668</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> 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) { diff --git a/chrome/browser/browser.h b/chrome/browser/browser.h index cf92360..6507c98 100644 --- a/chrome/browser/browser.h +++ b/chrome/browser/browser.h @@ -373,6 +373,7 @@ class Browser : public TabStripModelDelegate, void ClosePopups(); #endif void Print(); + void EmailPageLocation(); void ToggleEncodingAutoDetect(); void OverrideEncoding(int encoding_id); diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc index 4799e6e..300be68d 100644 --- a/chrome/browser/tab_contents/tab_contents.cc +++ b/chrome/browser/tab_contents/tab_contents.cc @@ -58,6 +58,7 @@ #include "chrome/common/chrome_switches.h" #include "chrome/common/extensions/extension_action.h" #include "chrome/common/notification_service.h" +#include "chrome/common/platform_util.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" #include "chrome/common/render_messages.h" @@ -1100,6 +1101,14 @@ bool TabContents::SavePage(const FilePath& main_file, const FilePath& dir_path, return save_package_->Init(); } +void TabContents::EmailPageLocation() { + std::string title = EscapeQueryParamValue(UTF16ToUTF8(GetTitle()), false); + std::string page_url = EscapeQueryParamValue(GetURL().spec(), false); + std::string mailto = std::string("mailto:?subject=Fwd:%20") + + title + "&body=%0A%0A" + page_url; + platform_util::OpenExternal(GURL(mailto)); +} + void TabContents::PrintPreview() { // We don't show the print preview yet, only the print dialog. PrintNow(); diff --git a/chrome/browser/tab_contents/tab_contents.h b/chrome/browser/tab_contents/tab_contents.h index 50aae3f..072e430 100644 --- a/chrome/browser/tab_contents/tab_contents.h +++ b/chrome/browser/tab_contents/tab_contents.h @@ -551,6 +551,10 @@ class TabContents : public PageNavigator, bool SavePage(const FilePath& main_file, const FilePath& dir_path, SavePackage::SavePackageType save_type); + // Tells the user's email client to open a compose window containing the + // current page's URL. + void EmailPageLocation(); + // Displays asynchronously a print preview (generated by the renderer) if not // already displayed and ask the user for its preferred print settings with // the "Print..." dialog box. (managed by the print worker thread). diff --git a/chrome/common/platform_util_mac.mm b/chrome/common/platform_util_mac.mm index cf858eb..2c9883a 100644 --- a/chrome/common/platform_util_mac.mm +++ b/chrome/common/platform_util_mac.mm @@ -20,21 +20,24 @@ namespace platform_util { void ShowItemInFolder(const FilePath& full_path) { DCHECK_EQ([NSThread currentThread], [NSThread mainThread]); NSString* path_string = base::SysUTF8ToNSString(full_path.value()); - [[NSWorkspace sharedWorkspace] selectFile:path_string - inFileViewerRootedAtPath:nil]; + if (!path_string || ![[NSWorkspace sharedWorkspace] selectFile:path_string + inFileViewerRootedAtPath:nil]) + LOG(WARNING) << "NSWorkspace failed to select file " << full_path.value(); } void OpenItem(const FilePath& full_path) { DCHECK_EQ([NSThread currentThread], [NSThread mainThread]); NSString* path_string = base::SysUTF8ToNSString(full_path.value()); - [[NSWorkspace sharedWorkspace] openFile:path_string]; + if (!path_string || ![[NSWorkspace sharedWorkspace] openFile:path_string]) + LOG(WARNING) << "NSWorkspace failed to open file " << full_path.value(); } void OpenExternal(const GURL& url) { DCHECK_EQ([NSThread currentThread], [NSThread mainThread]); NSString* url_string = base::SysUTF8ToNSString(url.spec()); NSURL* ns_url = [NSURL URLWithString:url_string]; - [[NSWorkspace sharedWorkspace] openURL:ns_url]; + if (!ns_url || ![[NSWorkspace sharedWorkspace] openURL:ns_url]) + LOG(WARNING) << "NSWorkspace failed to open URL " << url; } gfx::NativeWindow GetTopLevel(gfx::NativeView view) { diff --git a/net/base/escape.cc b/net/base/escape.cc index db03fa8..184e93c 100644 --- a/net/base/escape.cc +++ b/net/base/escape.cc @@ -186,6 +186,10 @@ static const Charmap kQueryCharmap( 0xffffffffL, 0xfc00987dL, 0x78000001L, 0xb8000001L, 0xffffffffL, 0xffffffffL, 0xffffffffL, 0xffffffffL); +std::string EscapeQueryParamValue(const std::string& text, bool use_plus) { + return Escape(text, kQueryCharmap, use_plus); +} + std::string EscapeQueryParamValue(const std::string& text) { return Escape(text, kQueryCharmap, true); } diff --git a/net/base/escape.h b/net/base/escape.h index 5476d9c..679e613 100644 --- a/net/base/escape.h +++ b/net/base/escape.h @@ -110,6 +110,7 @@ string16 UnescapeAndDecodeUTF8URLComponent(const std::string& text, // Escapes characters in text suitable for use as a query parameter value. // We %XX everything except alphanumerics and -_.!~*'() +// Spaces change to "+" unless you pass usePlus=false. // This is basically the same as encodeURIComponent in javascript. // For the string16 version, we do a conversion to charset before encoding the // string. If the charset doesn't exist, we return false. @@ -117,6 +118,7 @@ string16 UnescapeAndDecodeUTF8URLComponent(const std::string& text, // TODO(brettw) bug 1201094: This function should be removed. See the bug for // why and what callers should do instead. std::string EscapeQueryParamValue(const std::string& text); +std::string EscapeQueryParamValue(const std::string& text, bool use_plus); bool EscapeQueryParamValue(const string16& text, const char* codepage, string16* escaped); |