Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / chromeos / drive / file_task_executor.cc
index 695ad4c..266b92a 100644 (file)
 #include "chrome/browser/chromeos/drive/file_system_interface.h"
 #include "chrome/browser/drive/drive_service_interface.h"
 #include "chrome/browser/profiles/profile_manager.h"
+#include "chrome/browser/ui/ash/multi_user/multi_user_util.h"
 #include "chrome/browser/ui/browser.h"
 #include "chrome/browser/ui/browser_tabstrip.h"
 #include "chrome/browser/ui/browser_window.h"
 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h"
+#include "chrome/common/extensions/api/file_browser_private.h"
 #include "content/public/browser/browser_thread.h"
 #include "webkit/browser/fileapi/file_system_url.h"
 
@@ -109,6 +111,10 @@ void FileTaskExecutor::OnAppAuthorized(const std::string& resource_id,
          profile_, chrome::HOST_DESKTOP_TYPE_ASH);
     chrome::AddSelectedTabWithURL(displayer.browser(), open_link,
                                   content::PAGE_TRANSITION_LINK);
+    // Since the ScopedTabbedBrowserDisplayer does not guarantee that the
+    // browser will be shown on the active desktop, we ensure the visibility.
+    multi_user_util::MoveWindowToCurrentDesktop(
+        displayer.browser()->window()->GetNativeWindow());
   }
 
   // We're done with this file.  If this is the last one, then we're done.
@@ -121,7 +127,9 @@ void FileTaskExecutor::OnAppAuthorized(const std::string& resource_id,
 void FileTaskExecutor::Done(bool success) {
   DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
   if (!done_.is_null())
-    done_.Run(success);
+    done_.Run(success
+                  ? extensions::api::file_browser_private::TASK_RESULT_OPENED
+                  : extensions::api::file_browser_private::TASK_RESULT_FAILED);
   delete this;
 }