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

Unified Diff: chrome/browser/ui/webui/about_ui.cc

Issue 10916182: Refactor the about:version code out of about_ui. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/about_ui.cc
===================================================================
--- chrome/browser/ui/webui/about_ui.cc (revision 154954)
+++ chrome/browser/ui/webui/about_ui.cc (working copy)
@@ -18,13 +18,11 @@
#include "base/json/json_writer.h"
#include "base/memory/ref_counted_memory.h"
#include "base/memory/singleton.h"
-#include "base/metrics/field_trial.h"
#include "base/metrics/statistics_recorder.h"
#include "base/metrics/stats_table.h"
#include "base/path_service.h"
#include "base/string_number_conversions.h"
#include "base/string_piece.h"
-#include "base/string_split.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
#include "base/threading/thread.h"
@@ -54,8 +52,6 @@
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
-#include "content/public/browser/web_ui.h"
-#include "content/public/browser/web_ui_message_handler.h"
#include "content/public/common/content_client.h"
#include "content/public/common/process_type.h"
#include "googleurl/src/gurl.h"
@@ -70,7 +66,6 @@
#include "ui/base/resource/resource_bundle.h"
#include "v8/include/v8.h"
#include "webkit/glue/user_agent.h"
-#include "webkit/glue/webkit_glue.h"
#include "webkit/plugins/webplugininfo.h"
#if defined(ENABLE_THEMES)
@@ -1130,11 +1125,7 @@
#if defined(OS_CHROMEOS)
new ChromeOSAboutVersionHandler(source, request_id);
#else
- DictionaryValue localized_strings;
- localized_strings.SetString("os_version", "");
- source->FinishDataRequest(
- AboutVersionStrings(&localized_strings, source->profile()),
- request_id);
+ // All other platforms are handled by VersionUI.
#endif
}
@@ -1297,64 +1288,6 @@
#endif
-class VersionDOMHandler : public content::WebUIMessageHandler {
- public:
- VersionDOMHandler();
- virtual ~VersionDOMHandler();
-
- // content::WebUIMessageHandler implementation.
- virtual void RegisterMessages() OVERRIDE;
-
- // Callback for the "requestVariationsList" message. This requests the list of
- // variations from the client and sends it to the frontend.
- void HandleRequestVariationsList(const ListValue* args);
-
- private:
- DISALLOW_COPY_AND_ASSIGN(VersionDOMHandler);
-};
-
-VersionDOMHandler::VersionDOMHandler() {
-}
-
-VersionDOMHandler::~VersionDOMHandler() {
-}
-
-void VersionDOMHandler::RegisterMessages() {
- web_ui()->RegisterMessageCallback(
- "requestVariationsList",
- base::Bind(&VersionDOMHandler::HandleRequestVariationsList,
- base::Unretained(this)));
-}
-
-void VersionDOMHandler::HandleRequestVariationsList(const ListValue* args) {
- scoped_ptr<ListValue> variations_list(new ListValue());
-#if !defined(NDEBUG)
- std::vector<std::string> variations;
- std::string variation_state;
- base::FieldTrialList::StatesToString(&variation_state);
-
- std::vector<std::string> tokens;
- base::SplitString(variation_state,
- base::FieldTrialList::kPersistentStringSeparator,
- &tokens);
- // Since StatesToString appends a separator at the end, SplitString will
- // append an extra empty string in the vector. Drop it. There should
- // always be an even number of tokens left.
- tokens.pop_back();
- DCHECK_EQ(0U, tokens.size() % 2);
- for (size_t i = 0; i < tokens.size(); i += 2)
- variations.push_back(tokens[i] + ":" + tokens[i + 1]);
-
- for (std::vector<std::string>::const_iterator it = variations.begin();
- it != variations.end(); ++it) {
- variations_list->Append(Value::CreateStringValue(*it));
- }
-#endif
- // In release mode, this will return an empty list to clear the section.
- web_ui()->CallJavascriptFunction("returnVariationsList",
- *variations_list.release());
-}
-
} // namespace
// AboutUIHTMLSource ----------------------------------------------------------
@@ -1463,8 +1396,6 @@
ChromeURLDataManager::AddDataSource(profile, theme);
#endif
- web_ui->AddMessageHandler(new VersionDOMHandler());
-
ChromeURLDataManager::DataSource* source =
new AboutUIHTMLSource(name, profile);
if (source) {

Powered by Google App Engine
This is Rietveld 408576698