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

Side by Side 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, 6 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/cocoa/share_menu/share_menu_manager.h"
6
7 #import "chrome/browser/ui/cocoa/share_menu/share_menu_controller.h"
8 #import <AppKit/AppKit.h>
9
10 static NSString* kSharePrefPane =
11 @"/System/Library/PreferencePanes/Extensions.prefPane";
12
13 @interface ShareMenuManager()
14 + (void)displayShareOptionsManagerDialog;
15 @end
16
17 @implementation ShareMenuManager
18
19 + (void)displayShareOptionsManagerDialog {
20 [[NSWorkspace sharedWorkspace] openFile:kSharePrefPane];
21 }
22
23 + (void)dispatchSharingServiceEventsFor:(NSSharingService*)service
24 AndPageInfo:(NSDictionary*)info {
25 base::scoped_nsobject<NSArray> shareItems;
26 NSArray* items = [info allValues];
27 if ([service canPerformWithItems:items]) {
28 if ([service isEqualTo:[NSSharingService sharingServiceNamed
29 : NSSharingServiceNameComposeEmail]]) {
30 shareItems.reset([[NSArray alloc]
31 initWithObjects:[info objectForKey:kPageUrl],
32 [info objectForKey:kPageHtml], nil]);
33
34 } else {
35 shareItems.reset([[NSArray alloc]
36 initWithObjects:[info objectForKey:kPageUrl],
37 [info objectForKey:kPageScreenShot], nil]);
38 }
39 [service performWithItems:shareItems];
40
41 } else {
42 NSLog(@"custom service %@", service);
43 if ([service.title isEqualToString:@"More"]) {
44 NSLog(@"opens a printer dialog here");
45 [ShareMenuManager displayShareOptionsManagerDialog];
46 }
47 }
48 }
49
50 @end
OLDNEW
« 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