OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/chromeos/drive/file_task_executor.h" | 5 #include "chrome/browser/chromeos/drive/file_task_executor.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "chrome/browser/chromeos/drive/drive.pb.h" | 10 #include "chrome/browser/chromeos/drive/drive.pb.h" |
11 #include "chrome/browser/chromeos/drive/drive_integration_service.h" | 11 #include "chrome/browser/chromeos/drive/drive_integration_service.h" |
12 #include "chrome/browser/chromeos/drive/file_system_interface.h" | 12 #include "chrome/browser/chromeos/drive/file_system_interface.h" |
13 #include "chrome/browser/drive/drive_service_interface.h" | 13 #include "chrome/browser/drive/drive_service_interface.h" |
14 #include "chrome/browser/profiles/profile_manager.h" | 14 #include "chrome/browser/profiles/profile_manager.h" |
| 15 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" |
15 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
16 #include "chrome/browser/ui/browser_tabstrip.h" | 17 #include "chrome/browser/ui/browser_tabstrip.h" |
17 #include "chrome/browser/ui/browser_window.h" | 18 #include "chrome/browser/ui/browser_window.h" |
18 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" | 19 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" |
19 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
20 #include "webkit/browser/fileapi/file_system_url.h" | 21 #include "webkit/browser/fileapi/file_system_url.h" |
21 | 22 |
22 using fileapi::FileSystemURL; | 23 using fileapi::FileSystemURL; |
23 | 24 |
24 namespace drive { | 25 namespace drive { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 error != google_apis::HTTP_SUCCESS || open_link.is_empty()) { | 103 error != google_apis::HTTP_SUCCESS || open_link.is_empty()) { |
103 Done(false); | 104 Done(false); |
104 return; | 105 return; |
105 } | 106 } |
106 | 107 |
107 { | 108 { |
108 chrome::ScopedTabbedBrowserDisplayer displayer( | 109 chrome::ScopedTabbedBrowserDisplayer displayer( |
109 profile_, chrome::HOST_DESKTOP_TYPE_ASH); | 110 profile_, chrome::HOST_DESKTOP_TYPE_ASH); |
110 chrome::AddSelectedTabWithURL(displayer.browser(), open_link, | 111 chrome::AddSelectedTabWithURL(displayer.browser(), open_link, |
111 content::PAGE_TRANSITION_LINK); | 112 content::PAGE_TRANSITION_LINK); |
| 113 // Since the ScopedTabbedBrowserDisplayer does not guarantee that the |
| 114 // browser will be shown on the active desktop, we ensure the visibility. |
| 115 multi_user_util::MoveWindowToCurrentDesktop( |
| 116 displayer.browser()->window()->GetNativeWindow()); |
112 } | 117 } |
113 | 118 |
114 // We're done with this file. If this is the last one, then we're done. | 119 // We're done with this file. If this is the last one, then we're done. |
115 current_index_--; | 120 current_index_--; |
116 DCHECK_GE(current_index_, 0); | 121 DCHECK_GE(current_index_, 0); |
117 if (current_index_ == 0) | 122 if (current_index_ == 0) |
118 Done(true); | 123 Done(true); |
119 } | 124 } |
120 | 125 |
121 void FileTaskExecutor::Done(bool success) { | 126 void FileTaskExecutor::Done(bool success) { |
122 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 127 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
123 if (!done_.is_null()) | 128 if (!done_.is_null()) |
124 done_.Run(success); | 129 done_.Run(success); |
125 delete this; | 130 delete this; |
126 } | 131 } |
127 | 132 |
128 } // namespace drive | 133 } // namespace drive |
OLD | NEW |