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

Side by Side Diff: chrome/browser/ui/webui/uber/uber_ui.cc

Issue 11881055: Simplify WebUI data sources. Currently WebUI data sources implement a URLDataSourceDelegate interfa… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix issue in about_ui exposed by cros tests Created 7 years, 11 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/uber/uber_ui.h" 5 #include "chrome/browser/ui/webui/uber/uber_ui.h"
6 6
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/extensions/extension_service.h" 9 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 source->AddString("overridesHistory", 119 source->AddString("overridesHistory",
120 ASCIIToUTF16(overridesHistory ? "yes" : "no")); 120 ASCIIToUTF16(overridesHistory ? "yes" : "no"));
121 121
122 return source; 122 return source;
123 } 123 }
124 124
125 } // namespace 125 } // namespace
126 126
127 UberUI::UberUI(content::WebUI* web_ui) : WebUIController(web_ui) { 127 UberUI::UberUI(content::WebUI* web_ui) : WebUIController(web_ui) {
128 Profile* profile = Profile::FromWebUI(web_ui); 128 Profile* profile = Profile::FromWebUI(web_ui);
129 ChromeURLDataManager::AddDataSource(profile, CreateUberHTMLSource()); 129 ChromeURLDataManager::AddDataSourceImpl(profile, CreateUberHTMLSource());
130 130
131 RegisterSubpage(chrome::kChromeUIExtensionsFrameURL); 131 RegisterSubpage(chrome::kChromeUIExtensionsFrameURL);
132 RegisterSubpage(chrome::kChromeUIHelpFrameURL); 132 RegisterSubpage(chrome::kChromeUIHelpFrameURL);
133 RegisterSubpage(chrome::kChromeUIHistoryFrameURL); 133 RegisterSubpage(chrome::kChromeUIHistoryFrameURL);
134 RegisterSubpage(chrome::kChromeUISettingsFrameURL); 134 RegisterSubpage(chrome::kChromeUISettingsFrameURL);
135 RegisterSubpage(chrome::kChromeUIUberFrameURL); 135 RegisterSubpage(chrome::kChromeUIUberFrameURL);
136 } 136 }
137 137
138 UberUI::~UberUI() { 138 UberUI::~UberUI() {
139 STLDeleteValues(&sub_uis_); 139 STLDeleteValues(&sub_uis_);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 // return subpage->second->GetController()->OverrideHandleWebUIMessage( 177 // return subpage->second->GetController()->OverrideHandleWebUIMessage(
178 // source_url, message, args); 178 // source_url, message, args);
179 subpage->second->ProcessWebUIMessage(source_url, message, args); 179 subpage->second->ProcessWebUIMessage(source_url, message, args);
180 return true; 180 return true;
181 } 181 }
182 182
183 // UberFrameUI 183 // UberFrameUI
184 184
185 UberFrameUI::UberFrameUI(content::WebUI* web_ui) : WebUIController(web_ui) { 185 UberFrameUI::UberFrameUI(content::WebUI* web_ui) : WebUIController(web_ui) {
186 Profile* profile = Profile::FromWebUI(web_ui); 186 Profile* profile = Profile::FromWebUI(web_ui);
187 ChromeURLDataManager::AddDataSource(profile, 187 ChromeURLDataManager::AddDataSourceImpl(
188 CreateUberFrameHTMLSource(profile)); 188 profile, CreateUberFrameHTMLSource(profile));
189 189
190 // Register as an observer for when extensions are loaded and unloaded. 190 // Register as an observer for when extensions are loaded and unloaded.
191 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, 191 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED,
192 content::Source<Profile>(profile)); 192 content::Source<Profile>(profile));
193 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, 193 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED,
194 content::Source<Profile>(profile)); 194 content::Source<Profile>(profile));
195 } 195 }
196 196
197 UberFrameUI::~UberFrameUI() { 197 UberFrameUI::~UberFrameUI() {
198 } 198 }
(...skipping 17 matching lines...) Expand all
216 scoped_ptr<Value> overrideValue( 216 scoped_ptr<Value> overrideValue(
217 Value::CreateStringValue(overridesHistory ? "yes" : "no")); 217 Value::CreateStringValue(overridesHistory ? "yes" : "no"));
218 web_ui()->CallJavascriptFunction( 218 web_ui()->CallJavascriptFunction(
219 "uber_frame.setNavigationOverride", *controlsValue, *overrideValue); 219 "uber_frame.setNavigationOverride", *controlsValue, *overrideValue);
220 break; 220 break;
221 } 221 }
222 default: 222 default:
223 NOTREACHED(); 223 NOTREACHED();
224 } 224 }
225 } 225 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698