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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 return; | 68 return; |
69 } | 69 } |
70 | 70 |
71 if (drop_data->filenames.empty()) { | 71 if (drop_data->filenames.empty()) { |
72 DLOG(ERROR) << "Current drop data contains no files."; | 72 DLOG(ERROR) << "Current drop data contains no files."; |
73 return; | 73 return; |
74 } | 74 } |
75 | 75 |
76 const content::DropData::FileInfo& file_info = drop_data->filenames.front(); | 76 const content::DropData::FileInfo& file_info = drop_data->filenames.front(); |
77 | 77 |
78 file_to_install_ = base::FilePath::FromWStringHack( | 78 file_to_install_ = base::FilePath::FromUTF16Unsafe(file_info.path); |
79 UTF16ToWide(file_info.path)); | |
80 // Use the display name if provided, for checking file names | 79 // Use the display name if provided, for checking file names |
81 // (.path is likely a random hash value in that case). | 80 // (.path is likely a random hash value in that case). |
82 file_display_name_ = | 81 file_display_name_ = |
83 file_info.display_name.empty() ? file_info.path : file_info.display_name; | 82 file_info.display_name.empty() ? file_info.path : file_info.display_name; |
84 } | 83 } |
85 | 84 |
86 void InstallExtensionHandler::HandleStopDragMessage(const ListValue* args) { | 85 void InstallExtensionHandler::HandleStopDragMessage(const ListValue* args) { |
87 file_to_install_.clear(); | 86 file_to_install_.clear(); |
88 file_display_name_.clear(); | 87 file_display_name_.clear(); |
89 } | 88 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 void InstallExtensionHandler::HandleInstallDirectoryMessage( | 126 void InstallExtensionHandler::HandleInstallDirectoryMessage( |
128 const ListValue* args) { | 127 const ListValue* args) { |
129 Profile* profile = Profile::FromBrowserContext( | 128 Profile* profile = Profile::FromBrowserContext( |
130 web_ui()->GetWebContents()->GetBrowserContext()); | 129 web_ui()->GetWebContents()->GetBrowserContext()); |
131 UnpackedInstaller::Create( | 130 UnpackedInstaller::Create( |
132 ExtensionSystem::Get(profile)-> | 131 ExtensionSystem::Get(profile)-> |
133 extension_service())->Load(file_to_install_); | 132 extension_service())->Load(file_to_install_); |
134 } | 133 } |
135 | 134 |
136 } // namespace extensions | 135 } // namespace extensions |
OLD | NEW |