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/ui/webui/extensions/install_extension_handler.h" | 5 #include "chrome/browser/ui/webui/extensions/install_extension_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/extensions/crx_installer.h" | 10 #include "chrome/browser/extensions/crx_installer.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 if (!drop_data) { | 67 if (!drop_data) { |
68 DLOG(ERROR) << "No current drop data."; | 68 DLOG(ERROR) << "No current drop data."; |
69 return; | 69 return; |
70 } | 70 } |
71 | 71 |
72 if (drop_data->filenames.empty()) { | 72 if (drop_data->filenames.empty()) { |
73 DLOG(ERROR) << "Current drop data contains no files."; | 73 DLOG(ERROR) << "Current drop data contains no files."; |
74 return; | 74 return; |
75 } | 75 } |
76 | 76 |
77 const content::DropData::FileInfo& file_info = drop_data->filenames.front(); | 77 const ui::FileInfo& file_info = drop_data->filenames.front(); |
78 | 78 |
79 file_to_install_ = base::FilePath::FromUTF16Unsafe(file_info.path); | 79 file_to_install_ = file_info.path; |
80 // Use the display name if provided, for checking file names | 80 // Use the display name if provided, for checking file names |
81 // (.path is likely a random hash value in that case). | 81 // (.path is likely a random hash value in that case). |
82 file_display_name_ = | 82 // TODO(dcheng): It would be nice to make this a FilePath too. |
83 file_info.display_name.empty() ? file_info.path : file_info.display_name; | 83 file_display_name_ = file_info.display_name.empty() |
| 84 ? file_info.path.AsUTF16Unsafe() |
| 85 : file_info.display_name.AsUTF16Unsafe(); |
84 } | 86 } |
85 | 87 |
86 void InstallExtensionHandler::HandleStopDragMessage( | 88 void InstallExtensionHandler::HandleStopDragMessage( |
87 const base::ListValue* args) { | 89 const base::ListValue* args) { |
88 file_to_install_.clear(); | 90 file_to_install_.clear(); |
89 file_display_name_.clear(); | 91 file_display_name_.clear(); |
90 } | 92 } |
91 | 93 |
92 void InstallExtensionHandler::HandleInstallMessage( | 94 void InstallExtensionHandler::HandleInstallMessage( |
93 const base::ListValue* args) { | 95 const base::ListValue* args) { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 void InstallExtensionHandler::HandleInstallDirectoryMessage( | 133 void InstallExtensionHandler::HandleInstallDirectoryMessage( |
132 const base::ListValue* args) { | 134 const base::ListValue* args) { |
133 Profile* profile = Profile::FromBrowserContext( | 135 Profile* profile = Profile::FromBrowserContext( |
134 web_ui()->GetWebContents()->GetBrowserContext()); | 136 web_ui()->GetWebContents()->GetBrowserContext()); |
135 UnpackedInstaller::Create( | 137 UnpackedInstaller::Create( |
136 ExtensionSystem::Get(profile)-> | 138 ExtensionSystem::Get(profile)-> |
137 extension_service())->Load(file_to_install_); | 139 extension_service())->Load(file_to_install_); |
138 } | 140 } |
139 | 141 |
140 } // namespace extensions | 142 } // namespace extensions |
OLD | NEW |