| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "app/resource_bundle.h" | 7 #include "app/resource_bundle.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 public DOMMessageHandler, | 62 public DOMMessageHandler, |
| 63 public base::SupportsWeakPtr<SlideshowHandler> { | 63 public base::SupportsWeakPtr<SlideshowHandler> { |
| 64 public: | 64 public: |
| 65 SlideshowHandler(); | 65 SlideshowHandler(); |
| 66 virtual ~SlideshowHandler(); | 66 virtual ~SlideshowHandler(); |
| 67 | 67 |
| 68 // Init work after Attach. | 68 // Init work after Attach. |
| 69 void Init(); | 69 void Init(); |
| 70 | 70 |
| 71 // DirectoryLister::DirectoryListerDelegate methods: | 71 // DirectoryLister::DirectoryListerDelegate methods: |
| 72 virtual void OnListFile(const file_util::FileEnumerator::FindInfo& data); | 72 virtual void OnListFile( |
| 73 const net::DirectoryLister::DirectoryListerData& data); |
| 73 virtual void OnListDone(int error); | 74 virtual void OnListDone(int error); |
| 74 | 75 |
| 75 // DOMMessageHandler implementation. | 76 // DOMMessageHandler implementation. |
| 76 virtual DOMMessageHandler* Attach(DOMUI* dom_ui); | 77 virtual DOMMessageHandler* Attach(DOMUI* dom_ui); |
| 77 virtual void RegisterMessages(); | 78 virtual void RegisterMessages(); |
| 78 | 79 |
| 79 void GetChildrenForPath(const FilePath& path, bool is_refresh); | 80 void GetChildrenForPath(const FilePath& path, bool is_refresh); |
| 80 | 81 |
| 81 // Callback for the "getChildren" message. | 82 // Callback for the "getChildren" message. |
| 82 void HandleGetChildren(const ListValue* args); | 83 void HandleGetChildren(const ListValue* args); |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 return true; | 222 return true; |
| 222 } else { | 223 } else { |
| 223 return false; | 224 return false; |
| 224 } | 225 } |
| 225 #else | 226 #else |
| 226 return false; | 227 return false; |
| 227 #endif | 228 #endif |
| 228 } | 229 } |
| 229 | 230 |
| 230 void SlideshowHandler::OnListFile( | 231 void SlideshowHandler::OnListFile( |
| 231 const file_util::FileEnumerator::FindInfo& data) { | 232 const net::DirectoryLister::DirectoryListerData& data) { |
| 232 #if defined(OS_CHROMEOS) | 233 #if defined(OS_CHROMEOS) |
| 233 if (data.filename[0] == '.') { | 234 if (data.info.filename[0] == '.') { |
| 234 return; | 235 return; |
| 235 } | 236 } |
| 236 if (!PathIsImageFile(data.filename.c_str())) { | 237 if (!PathIsImageFile(data.info.filename.c_str())) { |
| 237 return; | 238 return; |
| 238 } | 239 } |
| 239 | 240 |
| 240 DictionaryValue* file_value = new DictionaryValue(); | 241 DictionaryValue* file_value = new DictionaryValue(); |
| 241 | 242 |
| 242 file_value->SetString(kPropertyTitle, data.filename); | 243 file_value->SetString(kPropertyTitle, data.info.filename); |
| 243 file_value->SetString(kPropertyPath, | 244 file_value->SetString(kPropertyPath, |
| 244 currentpath_.Append(data.filename).value()); | 245 currentpath_.Append(data.info.filename).value()); |
| 245 file_value->SetBoolean(kPropertyDirectory, S_ISDIR(data.stat.st_mode)); | 246 file_value->SetBoolean(kPropertyDirectory, S_ISDIR(data.info.stat.st_mode)); |
| 246 filelist_value_->Append(file_value); | 247 filelist_value_->Append(file_value); |
| 247 std::string val; | 248 std::string val; |
| 248 file_value->GetString(kPropertyTitle, &val); | 249 file_value->GetString(kPropertyTitle, &val); |
| 249 if (val == originalpath_.BaseName().value()) { | 250 if (val == originalpath_.BaseName().value()) { |
| 250 currentOffset_ = counter_; | 251 currentOffset_ = counter_; |
| 251 } | 252 } |
| 252 counter_++; | 253 counter_++; |
| 253 #endif | 254 #endif |
| 254 } | 255 } |
| 255 | 256 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 284 SlideshowUIHTMLSource* html_source = new SlideshowUIHTMLSource(); | 285 SlideshowUIHTMLSource* html_source = new SlideshowUIHTMLSource(); |
| 285 | 286 |
| 286 // Set up the chrome://slideshow/ source. | 287 // Set up the chrome://slideshow/ source. |
| 287 ChromeThread::PostTask( | 288 ChromeThread::PostTask( |
| 288 ChromeThread::IO, FROM_HERE, | 289 ChromeThread::IO, FROM_HERE, |
| 289 NewRunnableMethod( | 290 NewRunnableMethod( |
| 290 Singleton<ChromeURLDataManager>::get(), | 291 Singleton<ChromeURLDataManager>::get(), |
| 291 &ChromeURLDataManager::AddDataSource, | 292 &ChromeURLDataManager::AddDataSource, |
| 292 make_scoped_refptr(html_source))); | 293 make_scoped_refptr(html_source))); |
| 293 } | 294 } |
| OLD | NEW |