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

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

Issue 10683003: Moved CrxInstaller and CrxInstallerError into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Latest-er master Created 8 years, 5 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
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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 76
77 void InstallExtensionHandler::HandleInstallMessage(const ListValue* args) { 77 void InstallExtensionHandler::HandleInstallMessage(const ListValue* args) {
78 if (file_to_install_.empty()) { 78 if (file_to_install_.empty()) {
79 LOG(ERROR) << "No file captured to install."; 79 LOG(ERROR) << "No file captured to install.";
80 return; 80 return;
81 } 81 }
82 82
83 Browser* browser = browser::FindBrowserWithWebContents( 83 Browser* browser = browser::FindBrowserWithWebContents(
84 web_ui()->GetWebContents()); 84 web_ui()->GetWebContents());
85 Profile* profile = browser->profile(); 85 Profile* profile = browser->profile();
86 scoped_refptr<CrxInstaller> crx_installer( 86 scoped_refptr<extensions::CrxInstaller> crx_installer(
87 CrxInstaller::Create( 87 extensions::CrxInstaller::Create(
88 extensions::ExtensionSystem::Get(profile)->extension_service(), 88 extensions::ExtensionSystem::Get(profile)->extension_service(),
89 chrome::CreateExtensionInstallPromptWithBrowser(browser))); 89 chrome::CreateExtensionInstallPromptWithBrowser(browser)));
90 crx_installer->set_off_store_install_allow_reason( 90 crx_installer->set_off_store_install_allow_reason(
91 CrxInstaller::OffStoreInstallAllowedFromSettingsPage); 91 extensions::CrxInstaller::OffStoreInstallAllowedFromSettingsPage);
92 92
93 const bool kCaseSensitive = false; 93 const bool kCaseSensitive = false;
94 94
95 // Have to use EndsWith() because FilePath::Extension() would return ".js" for 95 // Have to use EndsWith() because FilePath::Extension() would return ".js" for
96 // "foo.user.js". 96 // "foo.user.js".
97 if (EndsWith(file_to_install_.BaseName().value(), 97 if (EndsWith(file_to_install_.BaseName().value(),
98 FILE_PATH_LITERAL(".user.js"), 98 FILE_PATH_LITERAL(".user.js"),
99 kCaseSensitive)) { 99 kCaseSensitive)) {
100 crx_installer->InstallUserScript( 100 crx_installer->InstallUserScript(
101 file_to_install_, 101 file_to_install_,
102 net::FilePathToFileURL(file_to_install_)); 102 net::FilePathToFileURL(file_to_install_));
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 }
OLDNEW
« no previous file with comments | « chrome/browser/policy/app_pack_updater.cc ('k') | chrome/browser/ui/webui/ntp/app_launcher_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698