mac: Add app.addRecentDocument API

This commit is contained in:
Cheng Zhao 2014-11-17 13:05:06 +08:00
parent 6aa69a06c8
commit c23ba7b504
5 changed files with 21 additions and 0 deletions

View file

@ -9,6 +9,7 @@
#include "atom/browser/native_window.h"
#include "atom/browser/window_list.h"
#import "base/mac/bundle_locations.h"
#import "base/mac/foundation_util.h"
#include "base/strings/sys_string_conversions.h"
namespace atom {
@ -17,6 +18,11 @@ void Browser::Focus() {
[[AtomApplication sharedApplication] activateIgnoringOtherApps:YES];
}
void Browser::AddRecentDocument(const base::FilePath& path) {
NSURL* u = [NSURL fileURLWithPath:base::mac::FilePathToNSString(path)];
[[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL:u];
}
std::string Browser::GetExecutableFileVersion() const {
NSDictionary* infoDictionary = base::mac::OuterBundle().infoDictionary;
NSString *version = [infoDictionary objectForKey:@"CFBundleVersion"];