win: Add app.clearRecentDocuments API
This commit is contained in:
parent
528f7bd45f
commit
48412769df
5 changed files with 21 additions and 0 deletions
|
@ -160,6 +160,8 @@ mate::ObjectTemplateBuilder App::GetObjectTemplateBuilder(
|
||||||
.SetMethod("isReady", base::Bind(&Browser::is_ready, browser))
|
.SetMethod("isReady", base::Bind(&Browser::is_ready, browser))
|
||||||
.SetMethod("addRecentDocument",
|
.SetMethod("addRecentDocument",
|
||||||
base::Bind(&Browser::AddRecentDocument, browser))
|
base::Bind(&Browser::AddRecentDocument, browser))
|
||||||
|
.SetMethod("clearRecentDocuments",
|
||||||
|
base::Bind(&Browser::ClearRecentDocuments, browser))
|
||||||
.SetMethod("getDataPath", &App::GetDataPath)
|
.SetMethod("getDataPath", &App::GetDataPath)
|
||||||
.SetMethod("resolveProxy", &App::ResolveProxy)
|
.SetMethod("resolveProxy", &App::ResolveProxy)
|
||||||
.SetMethod("setDesktopName", &App::SetDesktopName);
|
.SetMethod("setDesktopName", &App::SetDesktopName);
|
||||||
|
|
|
@ -59,6 +59,9 @@ class Browser : public WindowListObserver {
|
||||||
// Add the |path| to recent documents list.
|
// Add the |path| to recent documents list.
|
||||||
void AddRecentDocument(const base::FilePath& path);
|
void AddRecentDocument(const base::FilePath& path);
|
||||||
|
|
||||||
|
// Clear the recent documents list.
|
||||||
|
void ClearRecentDocuments();
|
||||||
|
|
||||||
#if defined(OS_MACOSX)
|
#if defined(OS_MACOSX)
|
||||||
// Bounce the dock icon.
|
// Bounce the dock icon.
|
||||||
enum BounceType {
|
enum BounceType {
|
||||||
|
|
|
@ -27,6 +27,9 @@ void Browser::Focus() {
|
||||||
void Browser::AddRecentDocument(const base::FilePath& path) {
|
void Browser::AddRecentDocument(const base::FilePath& path) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Browser::ClearRecentDocuments() {
|
||||||
|
}
|
||||||
|
|
||||||
std::string Browser::GetExecutableFileVersion() const {
|
std::string Browser::GetExecutableFileVersion() const {
|
||||||
return ATOM_VERSION_STRING;
|
return ATOM_VERSION_STRING;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,9 @@ void Browser::AddRecentDocument(const base::FilePath& path) {
|
||||||
[[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL:u];
|
[[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL:u];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Browser::ClearRecentDocuments() {
|
||||||
|
}
|
||||||
|
|
||||||
std::string Browser::GetExecutableFileVersion() const {
|
std::string Browser::GetExecutableFileVersion() const {
|
||||||
NSDictionary* infoDictionary = base::mac::OuterBundle().infoDictionary;
|
NSDictionary* infoDictionary = base::mac::OuterBundle().infoDictionary;
|
||||||
NSString *version = [infoDictionary objectForKey:@"CFBundleVersion"];
|
NSString *version = [infoDictionary objectForKey:@"CFBundleVersion"];
|
||||||
|
|
|
@ -59,6 +59,16 @@ void Browser::AddRecentDocument(const base::FilePath& path) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Browser::ClearRecentDocuments() {
|
||||||
|
CComPtr<IApplicationDestinations> destinations;
|
||||||
|
if (FAILED(destinations.CoCreateInstance(CLSID_ApplicationDestinations,
|
||||||
|
NULL, CLSCTX_INPROC_SERVER)))
|
||||||
|
return;
|
||||||
|
if (FAILED(destinations->SetAppID(app_user_model_id_.c_str())))
|
||||||
|
return;
|
||||||
|
destinations->RemoveAllDestinations();
|
||||||
|
}
|
||||||
|
|
||||||
void Browser::SetAppUserModelID(const std::string& name) {
|
void Browser::SetAppUserModelID(const std::string& name) {
|
||||||
app_user_model_id_ = base::UTF8ToUTF16(
|
app_user_model_id_ = base::UTF8ToUTF16(
|
||||||
base::StringPrintf("atom-shell.app.%s", name));
|
base::StringPrintf("atom-shell.app.%s", name));
|
||||||
|
|
Loading…
Reference in a new issue