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/gdata/drive_task_executor.h" | 5 #include "chrome/browser/chromeos/gdata/drive_task_executor.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
12 #include "chrome/browser/chromeos/extensions/file_browser_private_api.h" | 12 #include "chrome/browser/chromeos/extensions/file_browser_private_api.h" |
13 #include "chrome/browser/chromeos/gdata/gdata_documents_service.h" | 13 #include "chrome/browser/chromeos/gdata/gdata_documents_service.h" |
14 #include "chrome/browser/chromeos/gdata/gdata_system_service.h" | 14 #include "chrome/browser/chromeos/gdata/gdata_system_service.h" |
15 #include "chrome/browser/chromeos/gdata/gdata.pb.h" | 15 #include "chrome/browser/chromeos/gdata/gdata.pb.h" |
16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
17 #include "chrome/browser/profiles/profile_manager.h" | 17 #include "chrome/browser/profiles/profile_manager.h" |
18 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
19 #include "chrome/browser/ui/browser_finder.h" | 19 #include "chrome/browser/ui/browser_finder.h" |
| 20 #include "chrome/browser/ui/browser_tabstrip.h" |
20 #include "chrome/browser/ui/browser_window.h" | 21 #include "chrome/browser/ui/browser_window.h" |
21 #include "content/public/browser/browser_thread.h" | 22 #include "content/public/browser/browser_thread.h" |
22 #include "webkit/fileapi/file_system_types.h" | 23 #include "webkit/fileapi/file_system_types.h" |
23 #include "webkit/fileapi/file_system_util.h" | 24 #include "webkit/fileapi/file_system_util.h" |
24 | 25 |
25 namespace gdata { | 26 namespace gdata { |
26 | 27 |
27 using file_handler_util::FileTaskExecutor; | 28 using file_handler_util::FileTaskExecutor; |
28 | 29 |
29 DriveTaskExecutor::DriveTaskExecutor(Profile* profile, | 30 DriveTaskExecutor::DriveTaskExecutor(Profile* profile, |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 break; | 143 break; |
143 } | 144 } |
144 } | 145 } |
145 | 146 |
146 if (open_with_url.is_empty()) { | 147 if (open_with_url.is_empty()) { |
147 Done(false); | 148 Done(false); |
148 return; | 149 return; |
149 } | 150 } |
150 | 151 |
151 Browser* browser = GetBrowser(); | 152 Browser* browser = GetBrowser(); |
152 browser->AddSelectedTabWithURL(open_with_url, content::PAGE_TRANSITION_LINK); | 153 chrome::AddSelectedTabWithURL(browser, open_with_url, |
| 154 content::PAGE_TRANSITION_LINK); |
153 // If the current browser is not tabbed then the new tab will be created | 155 // If the current browser is not tabbed then the new tab will be created |
154 // in a different browser. Make sure it is visible. | 156 // in a different browser. Make sure it is visible. |
155 browser->window()->Show(); | 157 browser->window()->Show(); |
156 | 158 |
157 // We're done with this file. If this is the last one, then we're done. | 159 // We're done with this file. If this is the last one, then we're done. |
158 current_index_--; | 160 current_index_--; |
159 DCHECK(current_index_ >= 0); | 161 DCHECK(current_index_ >= 0); |
160 if (current_index_ == 0) | 162 if (current_index_ == 0) |
161 Done(true); | 163 Done(true); |
162 } | 164 } |
163 | 165 |
164 void DriveTaskExecutor::Done(bool success) { | 166 void DriveTaskExecutor::Done(bool success) { |
165 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 167 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
166 current_index_ = 0; | 168 current_index_ = 0; |
167 if (!done_.is_null()) | 169 if (!done_.is_null()) |
168 done_.Run(success); | 170 done_.Run(success); |
169 done_.Reset(); | 171 done_.Reset(); |
170 } | 172 } |
171 | 173 |
172 } // namespace gdata | 174 } // namespace gdata |
OLD | NEW |