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

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

Issue 10542048: Add a group policy controlling which sites can install extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 6 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/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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
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;
80 } 80 }
81 81
82 Profile* profile = Profile::FromWebUI(web_ui()); 82 Profile* profile = Profile::FromWebUI(web_ui());
83 scoped_refptr<CrxInstaller> crx_installer( 83 scoped_refptr<CrxInstaller> crx_installer(
84 CrxInstaller::Create( 84 CrxInstaller::Create(
85 ExtensionSystem::Get(profile)->extension_service(), 85 ExtensionSystem::Get(profile)->extension_service(),
86 new ExtensionInstallPrompt(profile))); 86 new ExtensionInstallPrompt(profile)));
87 crx_installer->set_allow_off_store_install(true); 87 crx_installer->set_off_store_install_allow_reason(
88 CrxInstaller::OffStoreInstallAllowedFromSettingsPage);
88 89
89 const bool kCaseSensitive = false; 90 const bool kCaseSensitive = false;
90 91
91 // Have to use EndsWith() because FilePath::Extension() would return ".js" for 92 // Have to use EndsWith() because FilePath::Extension() would return ".js" for
92 // "foo.user.js". 93 // "foo.user.js".
93 if (EndsWith(file_to_install_.BaseName().value(), 94 if (EndsWith(file_to_install_.BaseName().value(),
94 FILE_PATH_LITERAL(".user.js"), 95 FILE_PATH_LITERAL(".user.js"),
95 kCaseSensitive)) { 96 kCaseSensitive)) {
96 crx_installer->InstallUserScript( 97 crx_installer->InstallUserScript(
97 file_to_install_, 98 file_to_install_,
98 net::FilePathToFileURL(file_to_install_)); 99 net::FilePathToFileURL(file_to_install_));
99 } else if (EndsWith(file_to_install_.BaseName().value(), 100 } else if (EndsWith(file_to_install_.BaseName().value(),
100 FILE_PATH_LITERAL(".crx"), 101 FILE_PATH_LITERAL(".crx"),
101 kCaseSensitive)) { 102 kCaseSensitive)) {
102 crx_installer->InstallCrx(file_to_install_); 103 crx_installer->InstallCrx(file_to_install_);
103 } else { 104 } else {
104 CHECK(false); 105 CHECK(false);
105 } 106 }
106 107
107 file_to_install_.clear(); 108 file_to_install_.clear();
108 } 109 }
OLDNEW
« no previous file with comments | « chrome/browser/policy/configuration_policy_handler_unittest.cc ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698