OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/options/options_ui.h" | 5 #include "chrome/browser/ui/webui/options/options_ui.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 for (std::vector<WebUIMessageHandler*>::iterator iter = handlers_.begin() + 1; | 291 for (std::vector<WebUIMessageHandler*>::iterator iter = handlers_.begin() + 1; |
292 iter != handlers_.end(); | 292 iter != handlers_.end(); |
293 ++iter) { | 293 ++iter) { |
294 static_cast<OptionsPageUIHandler*>(*iter)->Uninitialize(); | 294 static_cast<OptionsPageUIHandler*>(*iter)->Uninitialize(); |
295 } | 295 } |
296 } | 296 } |
297 | 297 |
298 // Override. | 298 // Override. |
299 void OptionsUI::RenderViewCreated(RenderViewHost* render_view_host) { | 299 void OptionsUI::RenderViewCreated(RenderViewHost* render_view_host) { |
300 SetCommandLineString(render_view_host); | 300 SetCommandLineString(render_view_host); |
301 WebUI::RenderViewCreated(render_view_host); | 301 ChromeWebUI::RenderViewCreated(render_view_host); |
302 } | 302 } |
303 | 303 |
304 void OptionsUI::RenderViewReused(RenderViewHost* render_view_host) { | 304 void OptionsUI::RenderViewReused(RenderViewHost* render_view_host) { |
305 SetCommandLineString(render_view_host); | 305 SetCommandLineString(render_view_host); |
306 WebUI::RenderViewReused(render_view_host); | 306 ChromeWebUI::RenderViewReused(render_view_host); |
307 } | 307 } |
308 | 308 |
309 void OptionsUI::DidBecomeActiveForReusedRenderView() { | 309 void OptionsUI::DidBecomeActiveForReusedRenderView() { |
310 // When the renderer is re-used (e.g., for back/forward navigation within | 310 // When the renderer is re-used (e.g., for back/forward navigation within |
311 // options), the handlers are torn down and rebuilt, so are no longer | 311 // options), the handlers are torn down and rebuilt, so are no longer |
312 // initialized, but the web page's DOM may remain intact, in which case onload | 312 // initialized, but the web page's DOM may remain intact, in which case onload |
313 // won't fire to initilize the handlers. To make sure initialization always | 313 // won't fire to initilize the handlers. To make sure initialization always |
314 // happens, call reinitializeCore (which is a no-op unless the DOM was already | 314 // happens, call reinitializeCore (which is a no-op unless the DOM was already |
315 // initialized). | 315 // initialized). |
316 CallJavascriptFunction("OptionsPage.reinitializeCore"); | 316 CallJavascriptFunction("OptionsPage.reinitializeCore"); |
317 | 317 |
318 WebUI::DidBecomeActiveForReusedRenderView(); | 318 ChromeWebUI::DidBecomeActiveForReusedRenderView(); |
319 } | 319 } |
320 | 320 |
321 // static | 321 // static |
322 RefCountedMemory* OptionsUI::GetFaviconResourceBytes() { | 322 RefCountedMemory* OptionsUI::GetFaviconResourceBytes() { |
323 return ResourceBundle::GetSharedInstance(). | 323 return ResourceBundle::GetSharedInstance(). |
324 LoadDataResourceBytes(IDR_SETTINGS_FAVICON); | 324 LoadDataResourceBytes(IDR_SETTINGS_FAVICON); |
325 } | 325 } |
326 | 326 |
327 void OptionsUI::InitializeHandlers() { | 327 void OptionsUI::InitializeHandlers() { |
328 DCHECK(!GetProfile()->IsOffTheRecord() || Profile::IsGuestSession()); | 328 DCHECK(!GetProfile()->IsOffTheRecord() || Profile::IsGuestSession()); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 #if defined(OS_WIN) | 360 #if defined(OS_WIN) |
361 command_line_string = | 361 command_line_string = |
362 WideToASCII(CommandLine::ForCurrentProcess()->GetCommandLineString()); | 362 WideToASCII(CommandLine::ForCurrentProcess()->GetCommandLineString()); |
363 #else | 363 #else |
364 command_line_string = | 364 command_line_string = |
365 CommandLine::ForCurrentProcess()->GetCommandLineString(); | 365 CommandLine::ForCurrentProcess()->GetCommandLineString(); |
366 #endif | 366 #endif |
367 | 367 |
368 render_view_host->SetWebUIProperty("commandLineString", command_line_string); | 368 render_view_host->SetWebUIProperty("commandLineString", command_line_string); |
369 } | 369 } |
OLD | NEW |