summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorjackhou <jackhou@chromium.org>2015-05-24 21:49:55 -0700
committerCommit bot <commit-bot@chromium.org>2015-05-25 04:50:20 +0000
commitdaebca577af59c02c98f8d9e20cabefa7a3ad74a (patch)
treef3d0fd5d3d8600059012726264b0eb1e310a0349 /chrome
parente345e3c8be999296fc968adf09ca02f838ee430f (diff)
downloadchromium_src-daebca577af59c02c98f8d9e20cabefa7a3ad74a.zip
chromium_src-daebca577af59c02c98f8d9e20cabefa7a3ad74a.tar.gz
chromium_src-daebca577af59c02c98f8d9e20cabefa7a3ad74a.tar.bz2
Remove app_installer code.
This has been cancelled for a while. BUG=341353 Review URL: https://codereview.chromium.org/1132873009 Cr-Commit-Position: refs/heads/master@{#331258}
Diffstat (limited to 'chrome')
-rw-r--r--chrome/app_installer/BUILD.gn60
-rw-r--r--chrome/app_installer/DEPS5
-rw-r--r--chrome/app_installer/OWNERS2
-rw-r--r--chrome/app_installer/app_installer.gypi90
-rw-r--r--chrome/app_installer/win/app_installer.exe.manifest11
-rw-r--r--chrome/app_installer/win/app_installer_main.cc147
-rw-r--r--chrome/app_installer/win/app_installer_util.cc376
-rw-r--r--chrome/app_installer/win/app_installer_util.h59
-rw-r--r--chrome/app_installer/win/app_installer_util_unittest.cc74
-rw-r--r--chrome/chrome.gyp1
-rw-r--r--chrome/tools/build/win/FILES.cfg11
11 files changed, 0 insertions, 836 deletions
diff --git a/chrome/app_installer/BUILD.gn b/chrome/app_installer/BUILD.gn
deleted file mode 100644
index 90b15f6..0000000
--- a/chrome/app_installer/BUILD.gn
+++ /dev/null
@@ -1,60 +0,0 @@
-# Copyright 2015 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import("//testing/test.gni")
-
-assert(is_win)
-
-executable("app_installer") {
- sources = [
- "win/app_installer_main.cc",
- ]
-
- configs -= [ "//build/config/win:console" ]
- configs += [ "//build/config/win:windowed" ]
-
- deps = [
- ":util",
- "//base",
- "//mojo/environment:chromium",
- ]
-
- # TODO(GYP) manifest.
-}
-
-source_set("util") {
- sources = [
- "win/app_installer_util.cc",
- "win/app_installer_util.h",
- ]
-
- deps = [
- "//base",
- "//chrome/common",
- "//chrome/common:constants",
- "//chrome/installer/launcher_support",
- "//chrome/installer/util",
- "//chrome/installer/util:strings",
- "//content/public/common",
- "//net",
- "//third_party/omaha:extractor",
- ]
-}
-
-test("app_installer_unittests") {
- sources = [
- "win/app_installer_util_unittest.cc",
- ]
-
- deps = [
- ":util",
- "//base",
- "//base/test:run_all_unittests",
- "//mojo/environment:chromium",
- "//net:test_support",
- "//testing/gtest",
- ]
-
- # TODO(GYP) manifest
-}
diff --git a/chrome/app_installer/DEPS b/chrome/app_installer/DEPS
deleted file mode 100644
index ba842ed1..0000000
--- a/chrome/app_installer/DEPS
+++ /dev/null
@@ -1,5 +0,0 @@
-include_rules = [
- "+chrome/installer/launcher_support",
- "+chrome/installer/util",
- "+third_party/omaha",
-]
diff --git a/chrome/app_installer/OWNERS b/chrome/app_installer/OWNERS
deleted file mode 100644
index 1ecba6c..0000000
--- a/chrome/app_installer/OWNERS
+++ /dev/null
@@ -1,2 +0,0 @@
-benwells@chromium.org
-jackhou@chromium.org
diff --git a/chrome/app_installer/app_installer.gypi b/chrome/app_installer/app_installer.gypi
deleted file mode 100644
index ac382b5..0000000
--- a/chrome/app_installer/app_installer.gypi
+++ /dev/null
@@ -1,90 +0,0 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-{
- 'conditions': [
- ['OS=="win"', {
- 'targets': [
- {
- # GN version: //chrome/app_installer:util
- 'target_name': 'app_installer_util',
- 'type': 'static_library',
- 'dependencies': [
- 'common',
- 'installer_util',
- 'installer_util_strings',
- 'launcher_support',
- 'common_constants.gyp:common_constants',
- '../base/base.gyp:base',
- '../content/content.gyp:content_common',
- '../net/net.gyp:net',
- '../third_party/omaha/omaha.gyp:omaha_extractor',
- ],
- 'include_dirs': [
- '..',
- '<(INTERMEDIATE_DIR)',
- ],
- 'sources': [
- 'win/app_installer_util.cc',
- 'win/app_installer_util.h',
- ],
- },
- # TODO(jackhou): Add a version resource (using
- # version_resource_rules.gypi).
- {
- # GN version: //chrome/app_installer
- 'target_name': 'app_installer',
- 'type': 'executable',
- 'dependencies': [
- 'app_installer_util',
- '../base/base.gyp:base',
- ],
- 'include_dirs': [
- '..',
- '<(INTERMEDIATE_DIR)',
- ],
- 'sources': [
- 'win/app_installer_main.cc',
- ],
- 'msvs_settings': {
- 'VCLinkerTool': {
- 'SubSystem': '2', # Set /SUBSYSTEM:WINDOWS
- },
- 'VCManifestTool': {
- 'AdditionalManifestFiles': [
- 'app_installer/win/app_installer.exe.manifest',
- ],
- },
- },
- },
- {
- # GN version: //chrome/installer/app_installer:app_installer_unittests
- 'target_name': 'app_installer_unittests',
- 'type': 'executable',
- 'dependencies': [
- 'app_installer_util',
- '../base/base.gyp:base',
- '../base/base.gyp:run_all_unittests',
- '../net/net.gyp:net_test_support',
- '../testing/gtest.gyp:gtest',
- ],
- 'include_dirs': [
- '..',
- '<(INTERMEDIATE_DIR)',
- ],
- 'sources': [
- 'win/app_installer_util_unittest.cc',
- ],
- 'msvs_settings': {
- 'VCManifestTool': {
- 'AdditionalManifestFiles': [
- 'app_installer/win/app_installer.exe.manifest',
- ],
- },
- },
- },
- ],
- }],
- ],
-}
diff --git a/chrome/app_installer/win/app_installer.exe.manifest b/chrome/app_installer/win/app_installer.exe.manifest
deleted file mode 100644
index afb780f..0000000
--- a/chrome/app_installer/win/app_installer.exe.manifest
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
- <!--The compatibility section will be merged from build/win/compatibility.manifest -->
- <ms_asmv2:trustInfo xmlns:ms_asmv2="urn:schemas-microsoft-com:asm.v2">
- <ms_asmv2:security>
- <ms_asmv2:requestedPrivileges>
- <ms_asmv2:requestedExecutionLevel level="asInvoker" />
- </ms_asmv2:requestedPrivileges>
- </ms_asmv2:security>
- </ms_asmv2:trustInfo>
-</assembly>
diff --git a/chrome/app_installer/win/app_installer_main.cc b/chrome/app_installer/win/app_installer_main.cc
deleted file mode 100644
index 3266f9d..0000000
--- a/chrome/app_installer/win/app_installer_main.cc
+++ /dev/null
@@ -1,147 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <windows.h>
-#include <initguid.h>
-
-#include "base/at_exit.h"
-#include "base/base_paths.h"
-#include "base/basictypes.h"
-#include "base/command_line.h"
-#include "base/i18n/streaming_utf8_validator.h"
-#include "base/json/json_reader.h"
-#include "base/logging.h"
-#include "base/logging_win.h"
-#include "base/path_service.h"
-#include "base/process/launch.h"
-#include "base/strings/sys_string_conversions.h"
-#include "base/values.h"
-#include "chrome/app_installer/win/app_installer_util.h"
-#include "chrome/common/chrome_switches.h"
-#include "chrome/common/chrome_version_info.h"
-#include "chrome/installer/launcher_support/chrome_launcher_support.h"
-#include "chrome/installer/util/util_constants.h"
-#include "content/public/common/user_agent.h"
-
-namespace app_installer {
-
-namespace {
-
-// Log provider UUID. Required for logging to Sawbuck.
-// {d82c3b59-bacd-4625-8282-4d570c4dad12}
-DEFINE_GUID(kAppInstallerLogProvider,
- 0xd82c3b59,
- 0xbacd,
- 0x4625,
- 0x82, 0x82, 0x4d, 0x57, 0x0c, 0x4d, 0xad, 0x12);
-
-const wchar_t kChromeServer[] = L"chrome.google.com";
-
-const wchar_t kInlineInstallDetail[] = L"/webstore/inlineinstall/detail/";
-
-} // namespace
-
-extern "C"
-int WINAPI wWinMain(HINSTANCE instance,
- HINSTANCE prev_instance,
- wchar_t* command_line,
- int show_command) {
- base::AtExitManager exit_manager;
- base::CommandLine::Init(0, NULL);
- logging::LogEventProvider::Initialize(kAppInstallerLogProvider);
- logging::LoggingSettings settings;
- settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
- logging::InitLogging(settings);
-
- std::string app_id =
- base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
- switches::kAppId);
- const char* sxs = installer::switches::kChromeSxS;
- // --chrome-sxs on the command line takes precedence over chrome-sxs in the
- // tag.
- bool is_canary = base::CommandLine::ForCurrentProcess()->HasSwitch(sxs);
-
- // --app-id on the command line inhibits tag parsing altogether.
- if (app_id.empty()) {
- base::FilePath current_exe;
- if (!PathService::Get(base::FILE_EXE, &current_exe))
- return COULD_NOT_GET_FILE_PATH;
-
- // Get the tag added by dl.google.com. Note that this is passed in via URL
- // parameters when requesting a file to download, so it must be validated
- // before use.
- std::string tag = GetTag(current_exe);
- if (tag.empty())
- return COULD_NOT_READ_TAG;
-
- DVLOG(1) << "Tag: " << tag;
-
- std::map<std::string, std::string> parsed_pairs;
- if (!ParseTag(tag, &parsed_pairs))
- return COULD_NOT_PARSE_TAG;
-
- auto result = parsed_pairs.find(switches::kAppId);
- if (result != parsed_pairs.end())
- app_id = result->second;
-
- if (!is_canary) {
- result = parsed_pairs.find(sxs);
- is_canary = result != parsed_pairs.end() && result->second == "1";
- }
- }
-
- if (!IsValidAppId(app_id))
- return INVALID_APP_ID;
-
- // Get the inline install data for this app. We need to set the user agent
- // string to be Chrome's, otherwise webstore will serve a different response
- // (since inline installs don't work on non-Chrome).
- std::vector<uint8_t> response_data;
- if (!FetchUrl(base::SysUTF8ToWide(content::BuildUserAgentFromProduct(
- chrome::VersionInfo().ProductNameAndVersionForUserAgent())),
- kChromeServer, 0,
- kInlineInstallDetail + base::SysUTF8ToWide(app_id),
- &response_data) ||
- response_data.empty()) {
- return COULD_NOT_FETCH_INLINE_INSTALL_DATA;
- }
-
- // Check that the response is valid UTF-8.
- std::string inline_install_json(response_data.begin(), response_data.end());
- if (!base::StreamingUtf8Validator::Validate(inline_install_json))
- return COULD_NOT_PARSE_INLINE_INSTALL_DATA;
-
- // Parse the data to check it's valid JSON. The download page will just eval
- // it.
- base::JSONReader json_reader;
- scoped_ptr<base::Value> inline_install_data(
- json_reader.ReadToValue(inline_install_json));
- if (!inline_install_data) {
- LOG(ERROR) << json_reader.GetErrorMessage();
- return COULD_NOT_PARSE_INLINE_INSTALL_DATA;
- }
-
- base::FilePath chrome_path =
- chrome_launcher_support::GetAnyChromePath(is_canary);
- // If none found, show EULA, download, and install Chrome.
- if (chrome_path.empty()) {
- ExitCode get_chrome_result = GetChrome(is_canary, inline_install_json);
- if (get_chrome_result != SUCCESS)
- return get_chrome_result;
-
- chrome_path = chrome_launcher_support::GetAnyChromePath(is_canary);
- if (chrome_path.empty())
- return COULD_NOT_FIND_CHROME;
- }
-
- base::CommandLine cmd(chrome_path);
- cmd.AppendSwitchASCII(kInstallChromeApp, app_id);
- DVLOG(1) << "Install command: " << cmd.GetCommandLineString();
- bool launched = base::LaunchProcess(cmd, base::LaunchOptions()).IsValid();
- DVLOG(1) << "Launch " << (launched ? "success." : "failed.");
-
- return SUCCESS;
-}
-
-} // namespace app_installer
diff --git a/chrome/app_installer/win/app_installer_util.cc b/chrome/app_installer/win/app_installer_util.cc
deleted file mode 100644
index 51c3120..0000000
--- a/chrome/app_installer/win/app_installer_util.cc
+++ /dev/null
@@ -1,376 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/app_installer/win/app_installer_util.h"
-
-#include <windows.h>
-#include <urlmon.h>
-#include <winhttp.h>
-#pragma comment(lib, "urlmon.lib")
-#pragma comment(lib, "winhttp.lib")
-
-#include "base/base_paths.h"
-#include "base/basictypes.h"
-#include "base/command_line.h"
-#include "base/files/file_util.h"
-#include "base/json/json_string_value_serializer.h"
-#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/path_service.h"
-#include "base/process/launch.h"
-#include "base/strings/string16.h"
-#include "base/strings/string_split.h"
-#include "base/strings/string_util.h"
-#include "base/strings/stringprintf.h"
-#include "base/strings/sys_string_conversions.h"
-#include "base/values.h"
-#include "base/win/scoped_handle.h"
-#include "chrome/common/chrome_switches.h"
-#include "chrome/installer/launcher_support/chrome_launcher_support.h"
-#include "chrome/installer/util/google_update_util.h"
-#include "chrome/installer/util/html_dialog.h"
-#include "chrome/installer/util/master_preferences_constants.h"
-#include "chrome/installer/util/util_constants.h"
-#include "net/base/escape.h"
-#include "third_party/omaha/src/omaha/base/extractor.h"
-
-namespace app_installer {
-
-const char kInstallChromeApp[] = "install-chrome-app";
-
-namespace {
-
-// Copied from google_chrome_distribution.cc.
-const char kBrowserAppGuid[] = "{8A69D345-D564-463c-AFF1-A69D9E530F96}";
-
-// Copied frome google_chrome_sxs_distribution.cc.
-const char kSxSBrowserAppGuid[] = "{4ea16ac7-fd5a-47c3-875b-dbf4a2008c20}";
-
-const int kMaxTagLength = 4096;
-
-const wchar_t kDownloadAndEulaPage[] =
- L"https://tools.google.com/dlpage/chromeappinstaller";
-
-const wchar_t kSxSDownloadAndEulaPage[] =
- L"https://tools.google.com/dlpage/chromeappinstaller?sxs=true";
-
-const wchar_t kDialogDimensions[] = L"dialogWidth:750px;dialogHeight:500px";
-
-// This uses HTMLDialog to show a Chrome download page as a modal dialog.
-// The page includes the EULA and returns a download URL.
-class DownloadAndEulaHTMLDialog {
- public:
- explicit DownloadAndEulaHTMLDialog(bool is_canary,
- const std::string& dialog_arguments) {
- dialog_.reset(installer::CreateNativeHTMLDialog(
- is_canary ? kSxSDownloadAndEulaPage : kDownloadAndEulaPage,
- base::SysUTF8ToWide(dialog_arguments)));
- }
- ~DownloadAndEulaHTMLDialog() {}
-
- // Shows the dialog and blocks for user input. Returns the string passed back
- // by the web page via |window.returnValue|.
- base::string16 ShowModal() {
- Customizer customizer;
- dialog_->ShowModal(NULL, &customizer);
- return dialog_->GetExtraResult();
- }
-
- private:
- class Customizer : public installer::HTMLDialog::CustomizationCallback {
- public:
- void OnBeforeCreation(wchar_t** extra) override {
- *extra = const_cast<wchar_t*>(kDialogDimensions);
- }
-
- void OnBeforeDisplay(void* window) override {
- // Customize the window by removing the close button and replacing the
- // existing 'e' icon with the standard informational icon.
- if (!window)
- return;
- HWND top_window = static_cast<HWND>(window);
- LONG_PTR style = GetWindowLongPtrW(top_window, GWL_STYLE);
- SetWindowLongPtrW(top_window, GWL_STYLE, style & ~WS_SYSMENU);
- HICON ico = LoadIcon(NULL, IDI_INFORMATION);
- SendMessageW(
- top_window, WM_SETICON, ICON_SMALL, reinterpret_cast<LPARAM>(ico));
- }
- };
-
- scoped_ptr<installer::HTMLDialog> dialog_;
- DISALLOW_COPY_AND_ASSIGN(DownloadAndEulaHTMLDialog);
-};
-
-bool IsStringPrintable(const std::string& s) {
- return std::find_if_not(s.begin(), s.end(), isprint) == s.end();
-}
-
-bool IsLegalDataKeyChar(int c) {
- return isalnum(c) || c == '-' || c == '_' || c == '$';
-}
-
-bool IsDataKeyValid(const std::string& key) {
- return std::find_if_not(key.begin(), key.end(), IsLegalDataKeyChar) ==
- key.end();
-}
-
-struct WinHttpHandleTraits {
- typedef HINTERNET Handle;
- static bool CloseHandle(Handle handle) {
- return WinHttpCloseHandle(handle) != FALSE;
- }
- static bool IsHandleValid(Handle handle) { return !!handle; }
- static Handle NullHandle() { return 0; }
-
- private:
- DISALLOW_IMPLICIT_CONSTRUCTORS(WinHttpHandleTraits);
-};
-typedef base::win::GenericScopedHandle<WinHttpHandleTraits,
- base::win::DummyVerifierTraits>
- ScopedWinHttpHandle;
-
-// Reads the data portion of an HTTP response. WinHttpReceiveResponse() must
-// have already succeeded on this request.
-bool ReadHttpData(HINTERNET request_handle,
- std::vector<uint8_t>* response_data) {
- BOOL result = TRUE;
- do {
- // Check for available data.
- DWORD bytes_available = 0;
- result = WinHttpQueryDataAvailable(request_handle, &bytes_available);
- if (!result) {
- PLOG(ERROR);
- break;
- }
-
- if (bytes_available == 0)
- break;
-
- do {
- // Allocate space for the buffer.
- size_t offset = response_data->size();
- response_data->resize(offset + bytes_available);
-
- // Read the data.
- DWORD bytes_read = 0;
- result = WinHttpReadData(request_handle, &((*response_data)[offset]),
- bytes_available, &bytes_read);
- // MSDN for WinHttpQueryDataAvailable says:
- // The amount of data that remains is not recalculated until all
- // available data indicated by the call to WinHttpQueryDataAvailable is
- // read.
- // So we should either read all of |bytes_available| or bail out here.
- if (!result) {
- PLOG(ERROR);
- response_data->resize(offset);
- return false;
- }
-
- // MSDN for WinHttpReadData says:
- // If you are using WinHttpReadData synchronously, and the return value
- // is TRUE and the number of bytes read is zero, the transfer has been
- // completed and there are no more bytes to read on the handle.
- // Not sure if that's possible while |bytes_available| > 0, but better to
- // check and break out of both loops in this case.
- if (!bytes_read) {
- response_data->resize(offset);
- return true;
- }
-
- response_data->resize(offset + bytes_read);
- bytes_available -= bytes_read;
- } while (bytes_available);
- } while (true);
-
- return result != FALSE;
-}
-
-} // namespace
-
-// Gets the tag attached to a file by dl.google.com. This uses the same format
-// as Omaha. Returns the empty string on failure.
-std::string GetTag(const base::FilePath& file_name_path) {
- base::string16 file_name = file_name_path.value();
- omaha::TagExtractor extractor;
- if (!extractor.OpenFile(file_name.c_str()))
- return std::string();
-
- int tag_buffer_size = 0;
- if (!extractor.ExtractTag(NULL, &tag_buffer_size) || tag_buffer_size <= 1)
- return std::string();
-
- if (tag_buffer_size - 1 > kMaxTagLength) {
- LOG(ERROR) << "Tag length (" << tag_buffer_size - 1 << ") exceeds maximum ("
- << kMaxTagLength << ").";
- return std::string();
- }
-
- scoped_ptr<char[]> tag_buffer(new char[tag_buffer_size]);
- extractor.ExtractTag(tag_buffer.get(), &tag_buffer_size);
-
- return std::string(tag_buffer.get(), tag_buffer_size - 1);
-}
-
-// Parses |tag| as key-value pairs and overwrites |parsed_pairs| with
-// the result. |tag| should be a '&'-delimited list of '='-separated
-// key-value pairs, e.g. "key1=value1&key2=value2".
-// Returns true if the data could be parsed.
-bool ParseTag(const std::string& tag,
- std::map<std::string, std::string>* parsed_pairs) {
- DCHECK(parsed_pairs);
-
- base::StringPairs kv_pairs;
- if (!base::SplitStringIntoKeyValuePairs(tag, '=', '&', &kv_pairs)) {
- LOG(ERROR) << "Failed to parse tag: " << tag;
- return false;
- }
-
- parsed_pairs->clear();
- for (const auto& pair : kv_pairs) {
- const std::string& key(pair.first);
- const std::string& value(pair.second);
- if (IsDataKeyValid(key) && IsStringPrintable(value)) {
- (*parsed_pairs)[key] = value;
- } else {
- LOG(ERROR) << "Illegal character found in tag.";
- return false;
- }
- }
- return true;
-}
-
-bool IsValidAppId(const std::string& app_id) {
- if (app_id.size() != 32)
- return false;
-
- for (size_t i = 0; i < app_id.size(); ++i) {
- char c = base::ToLowerASCII(app_id[i]);
- if (c < 'a' || c > 'p')
- return false;
- }
-
- return true;
-}
-
-bool FetchUrl(const base::string16& user_agent,
- const base::string16& server_name,
- uint16_t server_port,
- const base::string16& object_name,
- std::vector<uint8_t>* response_data) {
- DCHECK(response_data);
-
- ScopedWinHttpHandle session_handle(
- WinHttpOpen(user_agent.c_str(), WINHTTP_ACCESS_TYPE_DEFAULT_PROXY,
- WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, 0));
- if (!session_handle.IsValid()) {
- PLOG(ERROR);
- return false;
- }
-
- ScopedWinHttpHandle connection_handle(WinHttpConnect(
- session_handle.Get(), server_name.c_str(), server_port, 0));
- if (!connection_handle.IsValid()) {
- PLOG(ERROR);
- return false;
- }
-
- ScopedWinHttpHandle request_handle(WinHttpOpenRequest(
- connection_handle.Get(), L"GET", object_name.c_str(), NULL,
- WINHTTP_NO_REFERER, WINHTTP_DEFAULT_ACCEPT_TYPES, WINHTTP_FLAG_SECURE));
- if (!request_handle.IsValid()) {
- PLOG(ERROR);
- return false;
- }
-
- if (!WinHttpSendRequest(request_handle.Get(), WINHTTP_NO_ADDITIONAL_HEADERS,
- 0, WINHTTP_NO_REQUEST_DATA, 0, 0, 0)) {
- PLOG(ERROR);
- return false;
- }
-
- if (!WinHttpReceiveResponse(request_handle.Get(), NULL)) {
- PLOG(ERROR);
- return false;
- }
-
- response_data->clear();
- return ReadHttpData(request_handle.Get(), response_data);
-}
-
-ExitCode GetChrome(bool is_canary, const std::string& inline_install_json) {
- // Show UI to install Chrome. The UI returns a download URL.
- base::string16 download_url =
- DownloadAndEulaHTMLDialog(is_canary, inline_install_json).ShowModal();
- if (download_url.empty())
- return EULA_CANCELLED;
-
- DVLOG(1) << "Chrome download url: " << download_url;
-
- // Get a temporary file path.
- base::FilePath setup_file;
- if (!base::CreateTemporaryFile(&setup_file))
- return COULD_NOT_GET_TMP_FILE_PATH;
-
- // Download the Chrome installer.
- HRESULT hr = URLDownloadToFile(
- NULL, download_url.c_str(), setup_file.value().c_str(), 0, NULL);
- if (FAILED(hr)) {
- LOG(ERROR) << "Download failed: Error " << std::hex << hr << ". "
- << setup_file.value();
- return FAILED_TO_DOWNLOAD_CHROME_SETUP;
- }
-
- // Construct the command line to pass to the installer so that it will not
- // launch Chrome upon completion.
- base::DictionaryValue installerdata_dict;
- base::DictionaryValue* distribution = new base::DictionaryValue();
- installerdata_dict.Set("distribution", distribution);
- distribution->SetBoolean(
- installer::master_preferences::kCreateAllShortcuts, false);
- distribution->SetBoolean(
- installer::master_preferences::kDoNotCreateDesktopShortcut, true);
- distribution->SetBoolean(
- installer::master_preferences::kDoNotCreateQuickLaunchShortcut, true);
- distribution->SetBoolean(
- installer::master_preferences::kDoNotCreateTaskbarShortcut, true);
- distribution->SetBoolean(
- installer::master_preferences::kDoNotLaunchChrome, true);
- distribution->SetBoolean(
- installer::master_preferences::kDoNotRegisterForUpdateLaunch, true);
- distribution->SetBoolean(
- installer::master_preferences::kDistroImportHistoryPref, false);
- distribution->SetBoolean(
- installer::master_preferences::kDistroImportSearchPref, false);
- distribution->SetBoolean(
- installer::master_preferences::kMakeChromeDefault, false);
- distribution->SetBoolean(
- installer::master_preferences::kSuppressFirstRunDefaultBrowserPrompt,
- true);
- std::string installerdata;
- JSONStringValueSerializer serializer(&installerdata);
- bool serialize_success = serializer.Serialize(installerdata_dict);
- DCHECK(serialize_success);
- std::string installerdata_url_encoded =
- net::EscapeQueryParamValue(installerdata, false);
- std::string appargs =
- base::StringPrintf("appguid=%s&installerdata=%s",
- is_canary ? kSxSBrowserAppGuid : kBrowserAppGuid,
- installerdata_url_encoded.c_str());
- base::CommandLine command_line(setup_file);
- command_line.AppendArg("/appargs");
- command_line.AppendArg(appargs);
- command_line.AppendArg("/install"); // Must be last.
-
- DVLOG(1) << "Chrome installer command line: "
- << command_line.GetCommandLineString();
-
- // Install Chrome. Wait for the installer to finish before returning.
- base::LaunchOptions options;
- options.wait = true;
- bool launch_success = base::LaunchProcess(command_line, options).IsValid();
- base::DeleteFile(setup_file, false);
- return launch_success ? SUCCESS : FAILED_TO_LAUNCH_CHROME_SETUP;
-}
-
-} // namespace app_installer
diff --git a/chrome/app_installer/win/app_installer_util.h b/chrome/app_installer/win/app_installer_util.h
deleted file mode 100644
index 33ed857..0000000
--- a/chrome/app_installer/win/app_installer_util.h
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_APP_INSTALLER_WIN_APP_INSTALLER_UTIL_H_
-#define CHROME_APP_INSTALLER_WIN_APP_INSTALLER_UTIL_H_
-
-#include <map>
-#include <string>
-
-#include "base/files/file_path.h"
-
-namespace app_installer {
-
-extern const char kInstallChromeApp[];
-
-enum ExitCode {
- SUCCESS = 0,
- COULD_NOT_GET_FILE_PATH,
- COULD_NOT_READ_TAG,
- COULD_NOT_PARSE_TAG,
- INVALID_APP_ID,
- COULD_NOT_FETCH_INLINE_INSTALL_DATA,
- COULD_NOT_PARSE_INLINE_INSTALL_DATA,
- EULA_CANCELLED,
- COULD_NOT_FIND_CHROME,
- COULD_NOT_GET_TMP_FILE_PATH,
- FAILED_TO_DOWNLOAD_CHROME_SETUP,
- FAILED_TO_LAUNCH_CHROME_SETUP,
-};
-
-// Gets the tag attached to a file by dl.google.com. This uses the same format
-// as Omaha. Returns the empty string on failure.
-std::string GetTag(const base::FilePath& file_name_path);
-
-// Parses |tag| as key-value pairs and overwrites |parsed_pairs| with
-// the result. |tag| should be a '&'-delimited list of '='-separated
-// key-value pairs, e.g. "key1=value1&key2=value2".
-// Returns true if the data could be parsed.
-bool ParseTag(const std::string& tag,
- std::map<std::string, std::string>* parsed_pairs);
-
-bool IsValidAppId(const std::string& app_id);
-
-// Uses WinHTTP to make a GET request. |server_port| can be zero to use the
-// default port (80 or 443).
-bool FetchUrl(const base::string16& user_agent,
- const base::string16& server_name,
- uint16_t server_port,
- const base::string16& object_name,
- std::vector<uint8_t>* response_data);
-
-// Shows UI to download and install Chrome. Returns a failure code, or SUCCESS
-// if the installation completed successfully.
-ExitCode GetChrome(bool is_canary, const std::string& inline_install_json);
-
-} // namespace app_installer
-
-#endif // CHROME_APP_INSTALLER_WIN_APP_INSTALLER_UTIL_H_
diff --git a/chrome/app_installer/win/app_installer_util_unittest.cc b/chrome/app_installer/win/app_installer_util_unittest.cc
deleted file mode 100644
index 1c1ab00..0000000
--- a/chrome/app_installer/win/app_installer_util_unittest.cc
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/app_installer/win/app_installer_util.h"
-
-#include <map>
-#include <string>
-
-#include "base/files/file_util.h"
-#include "base/path_service.h"
-#include "base/strings/sys_string_conversions.h"
-#include "net/test/spawned_test_server/spawned_test_server.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace app_installer {
-
-TEST(AppInstallerUtilTest, ParseTag) {
- std::map<std::string, std::string> parsed_pairs;
-
- parsed_pairs.clear();
- EXPECT_TRUE(ParseTag("key1=value1&key2=value2", &parsed_pairs));
- EXPECT_EQ(2, parsed_pairs.size());
- EXPECT_EQ("value1", parsed_pairs["key1"]);
- EXPECT_EQ("value2", parsed_pairs["key2"]);
-
- parsed_pairs.clear();
- EXPECT_FALSE(ParseTag("a&b", &parsed_pairs));
-
- parsed_pairs.clear();
- EXPECT_FALSE(ParseTag("#=a", &parsed_pairs));
-
- parsed_pairs.clear();
- EXPECT_FALSE(ParseTag("a=\01", &parsed_pairs));
-}
-
-void TestFetchUrlWithScheme(net::SpawnedTestServer::Type type, bool success) {
- net::SpawnedTestServer http_server(
- type, net::SpawnedTestServer::kLocalhost,
- base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
- ASSERT_TRUE(http_server.Start());
-
- std::vector<uint8_t> response_data;
- net::HostPortPair host_port = http_server.host_port_pair();
- EXPECT_EQ(success,
- FetchUrl(L"user agent", base::SysUTF8ToWide(host_port.host()),
- host_port.port(), L"files/extensions/app/manifest.json",
- &response_data));
- if (success) {
- EXPECT_TRUE(response_data.size());
- base::FilePath source_root;
- ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &source_root));
- base::FilePath file_path = source_root.Append(
- FILE_PATH_LITERAL("chrome/test/data/extensions/app/manifest.json"));
- std::string file_contents;
- EXPECT_TRUE(base::ReadFileToString(file_path, &file_contents));
- EXPECT_EQ(file_contents,
- std::string(response_data.begin(), response_data.end()));
- } else {
- EXPECT_FALSE(response_data.size());
- }
-
- ASSERT_TRUE(http_server.Stop());
-}
-
-TEST(AppInstallerUtilTest, FetchUrlHttps) {
- TestFetchUrlWithScheme(net::SpawnedTestServer::TYPE_HTTPS, true);
-}
-
-TEST(AppInstallerUtilTest, FetchUrlNoHttps) {
- TestFetchUrlWithScheme(net::SpawnedTestServer::TYPE_HTTP, false);
-}
-
-} // namespace app_installer
diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp
index 1001ee3..7e2f369 100644
--- a/chrome/chrome.gyp
+++ b/chrome/chrome.gyp
@@ -114,7 +114,6 @@
['OS!="ios"', {
'includes': [
'../apps/apps.gypi',
- 'app_installer/app_installer.gypi',
'chrome_child.gypi',
'chrome_debugger.gypi',
'chrome_dll.gypi',
diff --git a/chrome/tools/build/win/FILES.cfg b/chrome/tools/build/win/FILES.cfg
index 39385de..6c779d5 100644
--- a/chrome/tools/build/win/FILES.cfg
+++ b/chrome/tools/build/win/FILES.cfg
@@ -706,17 +706,6 @@ FILES = [
'filename': 'gcapi_dll.dll',
'buildtype': ['dev', 'official'],
},
- # Chrome App Installer files (official build only):
- {
- 'filename': 'app_installer.exe',
- 'buildtype': ['official'],
- 'archive': 'app_installer.zip',
- },
- {
- 'filename': 'app_installer.exe.pdb',
- 'buildtype': ['official'],
- 'archive': 'app_installer.zip',
- },
# PDB files for Syzygy modified binaries. Only add to this section if you
# know what you're doing! The build configuration has to be modified to run
# Syzygy on the target in question before adding a staging dependency here!