Commit 1b29524a authored by estade@chromium.org's avatar estade@chromium.org

remove dead code in options page

BUG=none
TEST=none


Review URL: http://codereview.chromium.org/10266025

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@134857 0039d316-1c4b-4281-b951-d872f2087c98
parent 21620c21
......@@ -55,7 +55,6 @@
</if>
<script src="chrome://resources/css/tree.css.js"></script>
<script src="chrome://resources/js/cr.js"></script>
<script src="chrome://resources/js/cr/command_line.js"></script>
<script src="chrome://resources/js/event_tracker.js"></script>
<script src="chrome://resources/js/cr/event_target.js"></script>
<script src="chrome://resources/js/cr/ui.js"></script>
......
// Copyright (c) 2010 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.
/**
* @fileoverview CommandLine class, parses out individual options from a
* command line string.
*
* This file depends on chrome.commandLineString, which is only set if your
* Web UI explicitly sets it. The Web UI based options dialog does this from
* OptionsUI::RenderViewCreated, in options_ui.cc.
*/
cr.define('cr', function() {
/**
* Class to reperesent command line options passed to chrome.
*
* Instances of this class will have the following properties:
* executable: The name of the executable used to start chrome
*
* options: An object containing the named arguments. If the argument
* was assigned a value, such as --foo=bar, then options['--foo'] will be
* set to 'bar'. If the argument was not assigned a value, such as
* --enable-foo, then options['--enable-foo'] will be set to true.
*
* looseArguments: An array of arguments that were not associated with
* argument names.
*
* Note that the Chromium code that computes the command line string
* has a bug that strips quotes from command lines, so you can't really
* trust looseArguments or any argument that might contain spaces until
* http://code.google.com/p/chromium/issues/detail?id=56684 is fixed.
*
* @param {string} commandLineString The command line string to parse.
*/
function CommandLine(commandLineString) {
this.commandLineString_ = commandLineString;
this.parseOptions_(commandLineString.split(/\s+/));
}
/**
* Return the command line as a single string.
*/
CommandLine.prototype.toString = function() {
return this.commandLineString_;
};
/**
* Parse the array of command line options into this.executable, this.options,
* and this.looseArguments.
*
* @param {Array} ary The list of command line arguments. The first argument
* must be the executable name. Named command line arguments must start
* with two dashes, and may optionally be assigned a value as in
* --argument-name=value.
*/
CommandLine.prototype.parseOptions_ = function(ary) {
this.executable = ary.shift();
this.options = {};
this.looseArguments = [];
for (var i = 0; i < ary.length; i++) {
var arg = ary[i];
if (arg.substr(0, 2) == '--') {
var pos = arg.indexOf('=');
if (pos > 0) {
// Argument has a value: --argument-name=value
this.options[arg.substr(0, pos)] = arg.substr(pos + 1);
} else {
// Argument is a flag: --some-flag
this.options[arg] = true;
}
} else {
// Argument doesn't start with '--'.
this.looseArguments.push(arg);
}
}
};
var commandLine = null;
if (chrome && chrome.commandLineString) {
commandLine = new CommandLine(chrome.commandLineString);
} else {
console.warn('chrome.commandLineString is not present. Not initializing ' +
'cr.commandLine');
}
return {
CommandLine: CommandLine,
commandLine: commandLine
};
});
......@@ -73,8 +73,6 @@ without changes to the corresponding grd file. -->
file="shared/images/x-hover.png" type="BINDATA" />
<include name="IDR_SHARED_JS_CR"
file="shared/js/cr.js" type="BINDATA" />
<include name="IDR_SHARED_JS_CR_COMMAND_LINE"
file="shared/js/cr/command_line.js" type="BINDATA" />
<include name="IDR_SHARED_JS_CR_EVENT_TARGET"
file="shared/js/cr/event_target.js" type="BINDATA" />
<include name="IDR_SHARED_JS_CR_LINK_CONTROLLER"
......
......@@ -330,14 +330,6 @@ OptionsUI::~OptionsUI() {
handlers_[i]->Uninitialize();
}
void OptionsUI::RenderViewCreated(RenderViewHost* render_view_host) {
SetCommandLineString(render_view_host);
}
void OptionsUI::RenderViewReused(RenderViewHost* render_view_host) {
SetCommandLineString(render_view_host);
}
// static
void OptionsUI::ProcessAutocompleteSuggestions(
const AutocompleteResult& autocompleteResult,
......@@ -400,18 +392,4 @@ void OptionsUI::AddOptionsPageUIHandler(DictionaryValue* localized_strings,
}
}
void OptionsUI::SetCommandLineString(RenderViewHost* render_view_host) {
std::string command_line_string;
#if defined(OS_WIN)
command_line_string =
WideToASCII(CommandLine::ForCurrentProcess()->GetCommandLineString());
#else
command_line_string =
CommandLine::ForCurrentProcess()->GetCommandLineString();
#endif
render_view_host->SetWebUIProperty("commandLineString", command_line_string);
}
} // namespace options2
......@@ -112,11 +112,6 @@ class OptionsUI : public content::WebUIController,
static RefCountedMemory* GetFaviconResourceBytes();
// WebUIController implementation.
virtual void RenderViewCreated(
content::RenderViewHost* render_view_host) OVERRIDE;
virtual void RenderViewReused(
content::RenderViewHost* render_view_host) OVERRIDE;
// Overridden from OptionsPageUIHandlerHost:
virtual void InitializeHandlers() OVERRIDE;
......@@ -125,10 +120,6 @@ class OptionsUI : public content::WebUIController,
void AddOptionsPageUIHandler(base::DictionaryValue* localized_strings,
OptionsPageUIHandler* handler);
// Sets the WebUI CommandLineString property with arguments passed while
// launching chrome.
void SetCommandLineString(content::RenderViewHost* render_view_host);
bool initialized_handlers_;
std::vector<OptionsPageUIHandler*> handlers_;
......
......@@ -159,13 +159,6 @@ void UberUI::RenderViewCreated(RenderViewHost* render_view_host) {
}
}
void UberUI::RenderViewReused(RenderViewHost* render_view_host) {
for (SubpageMap::iterator iter = sub_uis_.begin(); iter != sub_uis_.end();
++iter) {
iter->second->GetController()->RenderViewReused(render_view_host);
}
}
bool UberUI::OverrideHandleWebUIMessage(const GURL& source_url,
const std::string& message,
const ListValue& args) {
......
......@@ -31,8 +31,6 @@ class UberUI : public content::WebUIController {
// We forward these to |sub_uis_|.
virtual void RenderViewCreated(
content::RenderViewHost* render_view_host) OVERRIDE;
virtual void RenderViewReused(
content::RenderViewHost* render_view_host) OVERRIDE;
private:
// A map from URL origin to WebUI instance.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment