Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: chrome/browser/ui/webui/extensions/pack_extension_handler.cc

Issue 10912041: Disallow packing or loading unpacked manifest v1 extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix fix Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/pack_extension_handler.h" 5 #include "chrome/browser/ui/webui/extensions/pack_extension_handler.h"
6 6
7 #include "base/bind.h"
8 #include "base/utf_string_conversions.h"
7 #include "chrome/browser/extensions/extension_creator.h" 9 #include "chrome/browser/extensions/extension_creator.h"
8 #include "chrome/browser/ui/chrome_select_file_policy.h" 10 #include "chrome/browser/ui/chrome_select_file_policy.h"
9 #include "base/bind.h"
10 #include "base/utf_string_conversions.h"
11 #include "content/public/browser/web_contents.h" 11 #include "content/public/browser/web_contents.h"
12 #include "content/public/browser/web_contents_view.h" 12 #include "content/public/browser/web_contents_view.h"
13 #include "content/public/browser/web_ui.h" 13 #include "content/public/browser/web_ui.h"
14 #include "grit/generated_resources.h" 14 #include "grit/generated_resources.h"
15 #include "ui/base/l10n/l10n_util.h" 15 #include "ui/base/l10n/l10n_util.h"
16 16
17 PackExtensionHandler::PackExtensionHandler() { 17 PackExtensionHandler::PackExtensionHandler() {
18 } 18 }
19 19
20 PackExtensionHandler::~PackExtensionHandler() { 20 PackExtensionHandler::~PackExtensionHandler() {
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 DCHECK_EQ(3U, args->GetSize()); 110 DCHECK_EQ(3U, args->GetSize());
111 111
112 if (!args->GetString(0, &extension_path_) || 112 if (!args->GetString(0, &extension_path_) ||
113 !args->GetString(1, &private_key_path_)) 113 !args->GetString(1, &private_key_path_))
114 NOTREACHED(); 114 NOTREACHED();
115 115
116 double flags_double = 0.0; 116 double flags_double = 0.0;
117 if (!args->GetDouble(2, &flags_double)) 117 if (!args->GetDouble(2, &flags_double))
118 NOTREACHED(); 118 NOTREACHED();
119 119
120 int run_flags = static_cast<int>(flags_double); 120 int run_flags =
121 static_cast<int>(flags_double) |
122 extensions::ExtensionCreator::kRequireModernManifestVersion;
121 123
122 FilePath root_directory = 124 FilePath root_directory =
123 FilePath::FromWStringHack(UTF8ToWide(extension_path_)); 125 FilePath::FromWStringHack(UTF8ToWide(extension_path_));
124 FilePath key_file = FilePath::FromWStringHack(UTF8ToWide(private_key_path_)); 126 FilePath key_file = FilePath::FromWStringHack(UTF8ToWide(private_key_path_));
125 127
126 if (root_directory.empty()) { 128 if (root_directory.empty()) {
127 if (extension_path_.empty()) { 129 if (extension_path_.empty()) {
128 ShowAlert(l10n_util::GetStringUTF8( 130 ShowAlert(l10n_util::GetStringUTF8(
129 IDS_EXTENSION_PACK_DIALOG_ERROR_ROOT_REQUIRED)); 131 IDS_EXTENSION_PACK_DIALOG_ERROR_ROOT_REQUIRED));
130 } else { 132 } else {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 FILE_PATH_LITERAL(""), 190 FILE_PATH_LITERAL(""),
189 web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow(), 191 web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow(),
190 NULL); 192 NULL);
191 } 193 }
192 194
193 void PackExtensionHandler::ShowAlert(const std::string& message) { 195 void PackExtensionHandler::ShowAlert(const std::string& message) {
194 ListValue arguments; 196 ListValue arguments;
195 arguments.Append(Value::CreateStringValue(message)); 197 arguments.Append(Value::CreateStringValue(message));
196 web_ui()->CallJavascriptFunction("PackExtensionOverlay.showError", arguments); 198 web_ui()->CallJavascriptFunction("PackExtensionOverlay.showError", arguments);
197 } 199 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698