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 #include "chrome/browser/chromeos/extensions/file_manager/file_manager_util.h" | 4 #include "chrome/browser/chromeos/extensions/file_manager/file_manager_util.h" |
5 | 5 |
6 #include "ash/shell.h" | 6 #include "ash/shell.h" |
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/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/json/json_file_value_serializer.h" | 10 #include "base/json/json_file_value_serializer.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 #include "chrome/browser/ui/browser_iterator.h" | 35 #include "chrome/browser/ui/browser_iterator.h" |
36 #include "chrome/browser/ui/browser_tabstrip.h" | 36 #include "chrome/browser/ui/browser_tabstrip.h" |
37 #include "chrome/browser/ui/browser_window.h" | 37 #include "chrome/browser/ui/browser_window.h" |
38 #include "chrome/browser/ui/extensions/application_launch.h" | 38 #include "chrome/browser/ui/extensions/application_launch.h" |
39 #include "chrome/browser/ui/host_desktop.h" | 39 #include "chrome/browser/ui/host_desktop.h" |
40 #include "chrome/browser/ui/simple_message_box.h" | 40 #include "chrome/browser/ui/simple_message_box.h" |
41 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 41 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
42 #include "chrome/common/chrome_paths.h" | 42 #include "chrome/common/chrome_paths.h" |
43 #include "chrome/common/chrome_switches.h" | 43 #include "chrome/common/chrome_switches.h" |
44 #include "chrome/common/url_constants.h" | 44 #include "chrome/common/url_constants.h" |
| 45 #include "chromeos/chromeos_switches.h" |
45 #include "content/public/browser/browser_thread.h" | 46 #include "content/public/browser/browser_thread.h" |
46 #include "content/public/browser/plugin_service.h" | 47 #include "content/public/browser/plugin_service.h" |
47 #include "content/public/browser/storage_partition.h" | 48 #include "content/public/browser/storage_partition.h" |
48 #include "content/public/browser/user_metrics.h" | 49 #include "content/public/browser/user_metrics.h" |
49 #include "content/public/browser/web_contents.h" | 50 #include "content/public/browser/web_contents.h" |
50 #include "content/public/common/pepper_plugin_info.h" | 51 #include "content/public/common/pepper_plugin_info.h" |
51 #include "grit/generated_resources.h" | 52 #include "grit/generated_resources.h" |
52 #include "net/base/escape.h" | 53 #include "net/base/escape.h" |
53 #include "net/base/net_util.h" | 54 #include "net/base/net_util.h" |
54 #include "ui/base/l10n/l10n_util.h" | 55 #include "ui/base/l10n/l10n_util.h" |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 } | 303 } |
303 } | 304 } |
304 } | 305 } |
305 } | 306 } |
306 | 307 |
307 return false; | 308 return false; |
308 } | 309 } |
309 | 310 |
310 bool IsFileManagerPackaged() { | 311 bool IsFileManagerPackaged() { |
311 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 312 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
312 return !command_line->HasSwitch(switches::kFileManagerLegacy); | 313 return !command_line->HasSwitch(chromeos::switches::kFileManagerLegacy); |
313 } | 314 } |
314 | 315 |
315 bool IsFileManagerNewUI() { | 316 bool IsFileManagerNewUI() { |
316 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 317 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
317 return !command_line->HasSwitch(switches::kFileManagerLegacyUI); | 318 return !command_line->HasSwitch(chromeos::switches::kFileManagerLegacyUI); |
318 } | 319 } |
319 | 320 |
320 // Grants file system access to the file browser. | 321 // Grants file system access to the file browser. |
321 bool GrantFileSystemAccessToFileBrowser(Profile* profile) { | 322 bool GrantFileSystemAccessToFileBrowser(Profile* profile) { |
322 // File browser always runs in the site for its extension id, so that is the | 323 // File browser always runs in the site for its extension id, so that is the |
323 // site for which file access permissions should be granted. | 324 // site for which file access permissions should be granted. |
324 GURL site = extensions::ExtensionSystem::Get(profile)->extension_service()-> | 325 GURL site = extensions::ExtensionSystem::Get(profile)->extension_service()-> |
325 GetSiteForExtensionId(kFileBrowserDomain); | 326 GetSiteForExtensionId(kFileBrowserDomain); |
326 fileapi::ExternalFileSystemMountPointProvider* external_provider = | 327 fileapi::ExternalFileSystemMountPointProvider* external_provider = |
327 BrowserContext::GetStoragePartitionForSite(profile, site)-> | 328 BrowserContext::GetStoragePartitionForSite(profile, site)-> |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
919 // If a bundled plugin is enabled, we should open pdf/swf files in a tab. | 920 // If a bundled plugin is enabled, we should open pdf/swf files in a tab. |
920 bool ShouldBeOpenedWithPlugin(Profile* profile, const char* file_extension) { | 921 bool ShouldBeOpenedWithPlugin(Profile* profile, const char* file_extension) { |
921 if (LowerCaseEqualsASCII(file_extension, kPdfExtension)) | 922 if (LowerCaseEqualsASCII(file_extension, kPdfExtension)) |
922 return IsPdfPluginEnabled(profile); | 923 return IsPdfPluginEnabled(profile); |
923 if (LowerCaseEqualsASCII(file_extension, kSwfExtension)) | 924 if (LowerCaseEqualsASCII(file_extension, kSwfExtension)) |
924 return IsFlashPluginEnabled(profile); | 925 return IsFlashPluginEnabled(profile); |
925 return false; | 926 return false; |
926 } | 927 } |
927 | 928 |
928 } // namespace file_manager_util | 929 } // namespace file_manager_util |
OLD | NEW |