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

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

Issue 10154004: re-use WebUIs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: WeakPtr solution Created 8 years, 7 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 } 159 }
160 } 160 }
161 161
162 void UberUI::RenderViewReused(RenderViewHost* render_view_host) { 162 void UberUI::RenderViewReused(RenderViewHost* render_view_host) {
163 for (SubpageMap::iterator iter = sub_uis_.begin(); iter != sub_uis_.end(); 163 for (SubpageMap::iterator iter = sub_uis_.begin(); iter != sub_uis_.end();
164 ++iter) { 164 ++iter) {
165 iter->second->GetController()->RenderViewReused(render_view_host); 165 iter->second->GetController()->RenderViewReused(render_view_host);
166 } 166 }
167 } 167 }
168 168
169 void UberUI::DidBecomeActiveForReusedRenderView() {
170 for (SubpageMap::iterator iter = sub_uis_.begin(); iter != sub_uis_.end();
171 ++iter) {
172 iter->second->GetController()->DidBecomeActiveForReusedRenderView();
173 }
174 }
175
176 bool UberUI::OverrideHandleWebUIMessage(const GURL& source_url, 169 bool UberUI::OverrideHandleWebUIMessage(const GURL& source_url,
177 const std::string& message, 170 const std::string& message,
178 const ListValue& args) { 171 const ListValue& args) {
179 // Find the appropriate subpage and forward the message. 172 // Find the appropriate subpage and forward the message.
180 SubpageMap::iterator subpage = sub_uis_.find(source_url.GetOrigin().spec()); 173 SubpageMap::iterator subpage = sub_uis_.find(source_url.GetOrigin().spec());
181 if (subpage == sub_uis_.end()) { 174 if (subpage == sub_uis_.end()) {
182 // The message was sent from the uber page itself. 175 // The message was sent from the uber page itself.
183 DCHECK_EQ(std::string(chrome::kChromeUIUberHost), source_url.host()); 176 DCHECK_EQ(std::string(chrome::kChromeUIUberHost), source_url.host());
184 return false; 177 return false;
185 } 178 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 scoped_ptr<Value> overrideValue( 221 scoped_ptr<Value> overrideValue(
229 Value::CreateStringValue(overridesHistory ? "yes" : "no")); 222 Value::CreateStringValue(overridesHistory ? "yes" : "no"));
230 web_ui()->CallJavascriptFunction( 223 web_ui()->CallJavascriptFunction(
231 "uber_frame.setNavigationOverride", *controlsValue, *overrideValue); 224 "uber_frame.setNavigationOverride", *controlsValue, *overrideValue);
232 break; 225 break;
233 } 226 }
234 default: 227 default:
235 NOTREACHED(); 228 NOTREACHED();
236 } 229 }
237 } 230 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/uber/uber_ui.h ('k') | content/browser/renderer_host/render_view_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698