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/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/extensions/crx_installer.h" | 10 #include "chrome/browser/extensions/crx_installer.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 DLOG(ERROR) << "No current drop data."; | 59 DLOG(ERROR) << "No current drop data."; |
60 return; | 60 return; |
61 } | 61 } |
62 | 62 |
63 if (drop_data->filenames.empty()) { | 63 if (drop_data->filenames.empty()) { |
64 DLOG(ERROR) << "Current drop data contains no files."; | 64 DLOG(ERROR) << "Current drop data contains no files."; |
65 return; | 65 return; |
66 } | 66 } |
67 | 67 |
68 file_to_install_ = base::FilePath::FromWStringHack( | 68 file_to_install_ = base::FilePath::FromWStringHack( |
69 UTF16ToWide(drop_data->filenames.front().path)); | 69 base::UTF16ToWide(drop_data->filenames.front().path)); |
70 } | 70 } |
71 | 71 |
72 void InstallExtensionHandler::HandleStopDragMessage(const ListValue* args) { | 72 void InstallExtensionHandler::HandleStopDragMessage(const ListValue* args) { |
73 file_to_install_.clear(); | 73 file_to_install_.clear(); |
74 } | 74 } |
75 | 75 |
76 void InstallExtensionHandler::HandleInstallMessage(const ListValue* args) { | 76 void InstallExtensionHandler::HandleInstallMessage(const ListValue* args) { |
77 if (file_to_install_.empty()) { | 77 if (file_to_install_.empty()) { |
78 LOG(ERROR) << "No file captured to install."; | 78 LOG(ERROR) << "No file captured to install."; |
79 return; | 79 return; |
(...skipping 23 matching lines...) Expand all Loading... |
103 } else if (EndsWith(file_to_install_.BaseName().value(), | 103 } else if (EndsWith(file_to_install_.BaseName().value(), |
104 FILE_PATH_LITERAL(".crx"), | 104 FILE_PATH_LITERAL(".crx"), |
105 kCaseSensitive)) { | 105 kCaseSensitive)) { |
106 crx_installer->InstallCrx(file_to_install_); | 106 crx_installer->InstallCrx(file_to_install_); |
107 } else { | 107 } else { |
108 CHECK(false); | 108 CHECK(false); |
109 } | 109 } |
110 | 110 |
111 file_to_install_.clear(); | 111 file_to_install_.clear(); |
112 } | 112 } |
OLD | NEW |