Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5991)

Unified Diff: chrome/browser/ui/cocoa/share_menu/share_menu_manager.mm

Issue 1105143005: Issue 465302:System wide share options on Mac Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adds an attachment to Mail Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/cocoa/share_menu/share_menu_manager.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/share_menu/share_menu_manager.mm
diff --git a/chrome/browser/ui/cocoa/share_menu/share_menu_manager.mm b/chrome/browser/ui/cocoa/share_menu/share_menu_manager.mm
new file mode 100644
index 0000000000000000000000000000000000000000..eb6cfeb0b9b27606a150c4c5974812833bc63d79
--- /dev/null
+++ b/chrome/browser/ui/cocoa/share_menu/share_menu_manager.mm
@@ -0,0 +1,50 @@
+// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/cocoa/share_menu/share_menu_manager.h"
+
+#import "chrome/browser/ui/cocoa/share_menu/share_menu_controller.h"
+#import <AppKit/AppKit.h>
+
+static NSString* kSharePrefPane =
+ @"/System/Library/PreferencePanes/Extensions.prefPane";
+
+@interface ShareMenuManager()
++ (void)displayShareOptionsManagerDialog;
+@end
+
+@implementation ShareMenuManager
+
++ (void)displayShareOptionsManagerDialog {
+ [[NSWorkspace sharedWorkspace] openFile:kSharePrefPane];
+}
+
++ (void)dispatchSharingServiceEventsFor:(NSSharingService*)service
+ AndPageInfo:(NSDictionary*)info {
+ base::scoped_nsobject<NSArray> shareItems;
+ NSArray* items = [info allValues];
+ if ([service canPerformWithItems:items]) {
+ if ([service isEqualTo:[NSSharingService sharingServiceNamed
+ : NSSharingServiceNameComposeEmail]]) {
+ shareItems.reset([[NSArray alloc]
+ initWithObjects:[info objectForKey:kPageUrl],
+ [info objectForKey:kPageHtml], nil]);
+
+ } else {
+ shareItems.reset([[NSArray alloc]
+ initWithObjects:[info objectForKey:kPageUrl],
+ [info objectForKey:kPageScreenShot], nil]);
+ }
+ [service performWithItems:shareItems];
+
+ } else {
+ NSLog(@"custom service %@", service);
+ if ([service.title isEqualToString:@"More"]) {
+ NSLog(@"opens a printer dialog here");
+ [ShareMenuManager displayShareOptionsManagerDialog];
+ }
+ }
+}
+
+@end
« no previous file with comments | « chrome/browser/ui/cocoa/share_menu/share_menu_manager.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698