| 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/dom_ui/slideshow_ui.h" | 5 #include "chrome/browser/dom_ui/slideshow_ui.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/singleton.h" | 10 #include "base/singleton.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 } | 141 } |
| 142 | 142 |
| 143 SlideshowHandler::~SlideshowHandler() { | 143 SlideshowHandler::~SlideshowHandler() { |
| 144 if (lister_.get()) { | 144 if (lister_.get()) { |
| 145 lister_->Cancel(); | 145 lister_->Cancel(); |
| 146 lister_->set_delegate(NULL); | 146 lister_->set_delegate(NULL); |
| 147 } | 147 } |
| 148 } | 148 } |
| 149 | 149 |
| 150 WebUIMessageHandler* SlideshowHandler::Attach(DOMUI* dom_ui) { | 150 WebUIMessageHandler* SlideshowHandler::Attach(DOMUI* dom_ui) { |
| 151 // Create our favicon data source. |
| 152 BrowserThread::PostTask( |
| 153 BrowserThread::IO, FROM_HERE, |
| 154 NewRunnableMethod( |
| 155 ChromeURLDataManager::GetInstance(), |
| 156 &ChromeURLDataManager::AddDataSource, |
| 157 make_scoped_refptr(new WebUIFavIconSource(dom_ui->GetProfile())))); |
| 151 profile_ = dom_ui->GetProfile(); | 158 profile_ = dom_ui->GetProfile(); |
| 152 // Create our favicon data source. | |
| 153 profile_->GetChromeURLDataManager()->AddDataSource( | |
| 154 new WebUIFavIconSource(profile_)); | |
| 155 return WebUIMessageHandler::Attach(dom_ui); | 159 return WebUIMessageHandler::Attach(dom_ui); |
| 156 } | 160 } |
| 157 | 161 |
| 158 void SlideshowHandler::Init() { | 162 void SlideshowHandler::Init() { |
| 159 } | 163 } |
| 160 | 164 |
| 161 void SlideshowHandler::RegisterMessages() { | 165 void SlideshowHandler::RegisterMessages() { |
| 162 dom_ui_->RegisterMessageCallback("getChildren", | 166 dom_ui_->RegisterMessageCallback("getChildren", |
| 163 NewCallback(this, &SlideshowHandler::HandleGetChildren)); | 167 NewCallback(this, &SlideshowHandler::HandleGetChildren)); |
| 164 dom_ui_->RegisterMessageCallback("refreshDirectory", | 168 dom_ui_->RegisterMessageCallback("refreshDirectory", |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 // | 277 // |
| 274 //////////////////////////////////////////////////////////////////////////////// | 278 //////////////////////////////////////////////////////////////////////////////// |
| 275 | 279 |
| 276 SlideshowUI::SlideshowUI(TabContents* contents) : DOMUI(contents) { | 280 SlideshowUI::SlideshowUI(TabContents* contents) : DOMUI(contents) { |
| 277 SlideshowHandler* handler = new SlideshowHandler(); | 281 SlideshowHandler* handler = new SlideshowHandler(); |
| 278 AddMessageHandler((handler)->Attach(this)); | 282 AddMessageHandler((handler)->Attach(this)); |
| 279 handler->Init(); | 283 handler->Init(); |
| 280 SlideshowUIHTMLSource* html_source = new SlideshowUIHTMLSource(); | 284 SlideshowUIHTMLSource* html_source = new SlideshowUIHTMLSource(); |
| 281 | 285 |
| 282 // Set up the chrome://slideshow/ source. | 286 // Set up the chrome://slideshow/ source. |
| 283 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); | 287 BrowserThread::PostTask( |
| 288 BrowserThread::IO, FROM_HERE, |
| 289 NewRunnableMethod( |
| 290 ChromeURLDataManager::GetInstance(), |
| 291 &ChromeURLDataManager::AddDataSource, |
| 292 make_scoped_refptr(html_source))); |
| 284 } | 293 } |
| OLD | NEW |