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

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

Issue 10196004: Changed ChromeURLDataManager to a ProfileKeyedService and made a Factory for it. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Made ChromeURLDataManager's destructor virtual Created 8 years, 8 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
« no previous file with comments | « chrome/browser/ui/webui/tracing_ui.cc ('k') | chrome/browser/ui/webui/web_ui_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 source->AddString("overridesHistory", 116 source->AddString("overridesHistory",
117 ASCIIToUTF16(overridesHistory ? "yes" : "no")); 117 ASCIIToUTF16(overridesHistory ? "yes" : "no"));
118 118
119 return source; 119 return source;
120 } 120 }
121 121
122 } // namespace 122 } // namespace
123 123
124 UberUI::UberUI(content::WebUI* web_ui) : WebUIController(web_ui) { 124 UberUI::UberUI(content::WebUI* web_ui) : WebUIController(web_ui) {
125 Profile* profile = Profile::FromWebUI(web_ui); 125 Profile* profile = Profile::FromWebUI(web_ui);
126 profile->GetChromeURLDataManager()->AddDataSource(CreateUberHTMLSource()); 126 ChromeURLDataManager::AddDataSource(profile, CreateUberHTMLSource());
127 127
128 // The user may use a virtual (short) URL to get to the page. To avoid 128 // The user may use a virtual (short) URL to get to the page. To avoid
129 // duplicate uber tabs, clear the virtual URL so that the omnibox will show 129 // duplicate uber tabs, clear the virtual URL so that the omnibox will show
130 // the real URL. http://crbug.com/111878. 130 // the real URL. http://crbug.com/111878.
131 NavigationController* controller = &web_ui->GetWebContents()->GetController(); 131 NavigationController* controller = &web_ui->GetWebContents()->GetController();
132 NavigationEntry* pending_entry = controller->GetPendingEntry(); 132 NavigationEntry* pending_entry = controller->GetPendingEntry();
133 if (pending_entry && !pending_entry->IsViewSourceMode()) 133 if (pending_entry && !pending_entry->IsViewSourceMode())
134 pending_entry->SetVirtualURL(GURL()); 134 pending_entry->SetVirtualURL(GURL());
135 135
136 RegisterSubpage(chrome::kChromeUIExtensionsFrameURL); 136 RegisterSubpage(chrome::kChromeUIExtensionsFrameURL);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 // return subpage->second->GetController()->OverrideHandleWebUIMessage( 189 // return subpage->second->GetController()->OverrideHandleWebUIMessage(
190 // source_url, message, args); 190 // source_url, message, args);
191 subpage->second->ProcessWebUIMessage(source_url, message, args); 191 subpage->second->ProcessWebUIMessage(source_url, message, args);
192 return true; 192 return true;
193 } 193 }
194 194
195 // UberFrameUI 195 // UberFrameUI
196 196
197 UberFrameUI::UberFrameUI(content::WebUI* web_ui) : WebUIController(web_ui) { 197 UberFrameUI::UberFrameUI(content::WebUI* web_ui) : WebUIController(web_ui) {
198 Profile* profile = Profile::FromWebUI(web_ui); 198 Profile* profile = Profile::FromWebUI(web_ui);
199 profile->GetChromeURLDataManager()->AddDataSource( 199 ChromeURLDataManager::AddDataSource(profile,
200 CreateUberFrameHTMLSource(profile)); 200 CreateUberFrameHTMLSource(profile));
201 201
202 // Register as an observer for when extensions are loaded and unloaded. 202 // Register as an observer for when extensions are loaded and unloaded.
203 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, 203 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED,
204 content::Source<Profile>(profile)); 204 content::Source<Profile>(profile));
205 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, 205 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED,
206 content::Source<Profile>(profile)); 206 content::Source<Profile>(profile));
207 } 207 }
208 208
209 UberFrameUI::~UberFrameUI() { 209 UberFrameUI::~UberFrameUI() {
(...skipping 18 matching lines...) Expand all
228 scoped_ptr<Value> overrideValue( 228 scoped_ptr<Value> overrideValue(
229 Value::CreateStringValue(overridesHistory ? "yes" : "no")); 229 Value::CreateStringValue(overridesHistory ? "yes" : "no"));
230 web_ui()->CallJavascriptFunction( 230 web_ui()->CallJavascriptFunction(
231 "uber_frame.setNavigationOverride", *controlsValue, *overrideValue); 231 "uber_frame.setNavigationOverride", *controlsValue, *overrideValue);
232 break; 232 break;
233 } 233 }
234 default: 234 default:
235 NOTREACHED(); 235 NOTREACHED();
236 } 236 }
237 } 237 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/tracing_ui.cc ('k') | chrome/browser/ui/webui/web_ui_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698