OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/file_manager/open_with_browser.h" | 5 #include "chrome/browser/chromeos/file_manager/open_with_browser.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
11 #include "base/threading/sequenced_worker_pool.h" | 11 #include "base/threading/sequenced_worker_pool.h" |
12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
13 #include "chrome/browser/chromeos/drive/file_system_util.h" | 13 #include "chrome/browser/chromeos/drive/file_system_util.h" |
| 14 #include "chrome/browser/drive/drive_api_util.h" |
14 #include "chrome/browser/plugins/plugin_prefs.h" | 15 #include "chrome/browser/plugins/plugin_prefs.h" |
15 #include "chrome/browser/profiles/profile_manager.h" | 16 #include "chrome/browser/profiles/profile_manager.h" |
16 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" | 17 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" |
17 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
18 #include "chrome/browser/ui/browser_tabstrip.h" | 19 #include "chrome/browser/ui/browser_tabstrip.h" |
19 #include "chrome/browser/ui/browser_window.h" | 20 #include "chrome/browser/ui/browser_window.h" |
20 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" | 21 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" |
21 #include "chrome/common/chrome_paths.h" | 22 #include "chrome/common/chrome_paths.h" |
22 #include "chrome/common/chrome_switches.h" | 23 #include "chrome/common/chrome_switches.h" |
23 #include "content/public/browser/browser_thread.h" | 24 #include "content/public/browser/browser_thread.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 GURL page_url = net::FilePathToFileURL(file_path); | 139 GURL page_url = net::FilePathToFileURL(file_path); |
139 // Override drive resource to point to internal handler instead of file URL. | 140 // Override drive resource to point to internal handler instead of file URL. |
140 if (drive::util::IsUnderDriveMountPoint(file_path)) { | 141 if (drive::util::IsUnderDriveMountPoint(file_path)) { |
141 page_url = drive::util::FilePathToDriveURL( | 142 page_url = drive::util::FilePathToDriveURL( |
142 drive::util::ExtractDrivePath(file_path)); | 143 drive::util::ExtractDrivePath(file_path)); |
143 } | 144 } |
144 OpenNewTab(profile, page_url); | 145 OpenNewTab(profile, page_url); |
145 return true; | 146 return true; |
146 } | 147 } |
147 | 148 |
148 if (drive::util::HasGDocFileExtension(file_path)) { | 149 if (drive::util::HasHostedDocumentExtension(file_path)) { |
149 if (drive::util::IsUnderDriveMountPoint(file_path)) { | 150 if (drive::util::IsUnderDriveMountPoint(file_path)) { |
150 // The file is on Google Docs. Open with drive URL. | 151 // The file is on Google Docs. Open with drive URL. |
151 GURL url = drive::util::FilePathToDriveURL( | 152 GURL url = drive::util::FilePathToDriveURL( |
152 drive::util::ExtractDrivePath(file_path)); | 153 drive::util::ExtractDrivePath(file_path)); |
153 OpenNewTab(profile, url); | 154 OpenNewTab(profile, url); |
154 } else { | 155 } else { |
155 // The file is local (downloaded from an attachment or otherwise copied). | 156 // The file is local (downloaded from an attachment or otherwise copied). |
156 // Parse the file to extract the Docs url and open this url. | 157 // Parse the file to extract the Docs url and open this url. |
157 base::PostTaskAndReplyWithResult( | 158 base::PostTaskAndReplyWithResult( |
158 BrowserThread::GetBlockingPool(), | 159 BrowserThread::GetBlockingPool(), |
(...skipping 19 matching lines...) Expand all Loading... |
178 base::FilePath::FromUTF8Unsafe("dummy").AddExtension(file_extension); | 179 base::FilePath::FromUTF8Unsafe("dummy").AddExtension(file_extension); |
179 if (file_path.MatchesExtension(kPdfExtension)) | 180 if (file_path.MatchesExtension(kPdfExtension)) |
180 return IsPdfPluginEnabled(profile); | 181 return IsPdfPluginEnabled(profile); |
181 if (file_path.MatchesExtension(kSwfExtension)) | 182 if (file_path.MatchesExtension(kSwfExtension)) |
182 return IsFlashPluginEnabled(profile); | 183 return IsFlashPluginEnabled(profile); |
183 return false; | 184 return false; |
184 } | 185 } |
185 | 186 |
186 } // namespace util | 187 } // namespace util |
187 } // namespace file_manager | 188 } // namespace file_manager |
OLD | NEW |