]> khamidou — GitHub mirrors - electron.git/commitdiff
win: Add app.clearRecentDocuments API
authorCheng Zhao <zcbenz@gmail.com>
Mon, 17 Nov 2014 08:13:47 +0000 (16:13 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Mon, 17 Nov 2014 08:13:47 +0000 (16:13 +0800)
atom/browser/api/atom_api_app.cc
atom/browser/browser.h
atom/browser/browser_linux.cc
atom/browser/browser_mac.mm
atom/browser/browser_win.cc

index f42b1e0d0c8ff3faeebd854e19e5269be4fe6bc6..8305b6a320ed05ab4ff9039c3f6c60cbe15f83b3 100644 (file)
@@ -160,6 +160,8 @@ mate::ObjectTemplateBuilder App::GetObjectTemplateBuilder(
       .SetMethod("isReady", base::Bind(&Browser::is_ready, browser))
       .SetMethod("addRecentDocument",
                  base::Bind(&Browser::AddRecentDocument, browser))
+      .SetMethod("clearRecentDocuments",
+                 base::Bind(&Browser::ClearRecentDocuments, browser))
       .SetMethod("getDataPath", &App::GetDataPath)
       .SetMethod("resolveProxy", &App::ResolveProxy)
       .SetMethod("setDesktopName", &App::SetDesktopName);
index aa3b3c07aa56be9a9442ef1d4a42989814151d84..6fed3eec0c650a5a4ea917452bf58d3c9bdf84d9 100644 (file)
@@ -59,6 +59,9 @@ class Browser : public WindowListObserver {
   // Add the |path| to recent documents list.
   void AddRecentDocument(const base::FilePath& path);
 
+  // Clear the recent documents list.
+  void ClearRecentDocuments();
+
 #if defined(OS_MACOSX)
   // Bounce the dock icon.
   enum BounceType {
index fceb127f20d0923f7b79a0edb06d6ef457960c28..7534aa2182d9babbefb7b364cd9388d962b06179 100644 (file)
@@ -27,6 +27,9 @@ void Browser::Focus() {
 void Browser::AddRecentDocument(const base::FilePath& path) {
 }
 
+void Browser::ClearRecentDocuments() {
+}
+
 std::string Browser::GetExecutableFileVersion() const {
   return ATOM_VERSION_STRING;
 }
index 1cb1f6f8faab5e0cc9b1044b0a2d55e3804f5468..797c560728fa1cd1600b55a12755aac7476bbf32 100644 (file)
@@ -23,6 +23,9 @@ void Browser::AddRecentDocument(const base::FilePath& path) {
   [[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL:u];
 }
 
+void Browser::ClearRecentDocuments() {
+}
+
 std::string Browser::GetExecutableFileVersion() const {
   NSDictionary* infoDictionary = base::mac::OuterBundle().infoDictionary;
   NSString *version = [infoDictionary objectForKey:@"CFBundleVersion"];
index 91550ace4a7d5e495105f08bb7e9a00bd951acc4..c5e3aadc8be3a09d18b93412fae64a1ad5839b21 100644 (file)
@@ -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) {
   app_user_model_id_ = base::UTF8ToUTF16(
       base::StringPrintf("atom-shell.app.%s", name));