| 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/slideshow_ui.h" | 5 #include "chrome/browser/ui/webui/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 26 matching lines...) Expand all Loading... |
| 37 static const char kPropertyOffset[] = "currentOffset"; | 37 static const char kPropertyOffset[] = "currentOffset"; |
| 38 static const char kPropertyDirectory[] = "isDirectory"; | 38 static const char kPropertyDirectory[] = "isDirectory"; |
| 39 | 39 |
| 40 class SlideshowUIHTMLSource : public ChromeURLDataManager::DataSource { | 40 class SlideshowUIHTMLSource : public ChromeURLDataManager::DataSource { |
| 41 public: | 41 public: |
| 42 SlideshowUIHTMLSource(); | 42 SlideshowUIHTMLSource(); |
| 43 | 43 |
| 44 // Called when the network layer has requested a resource underneath | 44 // Called when the network layer has requested a resource underneath |
| 45 // the path we registered. | 45 // the path we registered. |
| 46 virtual void StartDataRequest(const std::string& path, | 46 virtual void StartDataRequest(const std::string& path, |
| 47 bool is_off_the_record, | 47 bool is_incognito, |
| 48 int request_id); | 48 int request_id); |
| 49 virtual std::string GetMimeType(const std::string&) const { | 49 virtual std::string GetMimeType(const std::string&) const { |
| 50 return "text/html"; | 50 return "text/html"; |
| 51 } | 51 } |
| 52 | 52 |
| 53 private: | 53 private: |
| 54 ~SlideshowUIHTMLSource() {} | 54 ~SlideshowUIHTMLSource() {} |
| 55 | 55 |
| 56 DISALLOW_COPY_AND_ASSIGN(SlideshowUIHTMLSource); | 56 DISALLOW_COPY_AND_ASSIGN(SlideshowUIHTMLSource); |
| 57 }; | 57 }; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 // | 102 // |
| 103 // SlideshowHTMLSource | 103 // SlideshowHTMLSource |
| 104 // | 104 // |
| 105 //////////////////////////////////////////////////////////////////////////////// | 105 //////////////////////////////////////////////////////////////////////////////// |
| 106 | 106 |
| 107 SlideshowUIHTMLSource::SlideshowUIHTMLSource() | 107 SlideshowUIHTMLSource::SlideshowUIHTMLSource() |
| 108 : DataSource(chrome::kChromeUISlideshowHost, MessageLoop::current()) { | 108 : DataSource(chrome::kChromeUISlideshowHost, MessageLoop::current()) { |
| 109 } | 109 } |
| 110 | 110 |
| 111 void SlideshowUIHTMLSource::StartDataRequest(const std::string& path, | 111 void SlideshowUIHTMLSource::StartDataRequest(const std::string& path, |
| 112 bool is_off_the_record, | 112 bool is_incognito, |
| 113 int request_id) { | 113 int request_id) { |
| 114 DictionaryValue localized_strings; | 114 DictionaryValue localized_strings; |
| 115 // TODO(dhg): Add stirings to localized strings, also add more strings | 115 // TODO(dhg): Add stirings to localized strings, also add more strings |
| 116 // that are currently hardcoded. | 116 // that are currently hardcoded. |
| 117 SetFontAndTextDirection(&localized_strings); | 117 SetFontAndTextDirection(&localized_strings); |
| 118 | 118 |
| 119 static const base::StringPiece slideshow_html( | 119 static const base::StringPiece slideshow_html( |
| 120 ResourceBundle::GetSharedInstance().GetRawDataResource( | 120 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 121 IDR_SLIDESHOW_HTML)); | 121 IDR_SLIDESHOW_HTML)); |
| 122 const std::string full_html = jstemplate_builder::GetI18nTemplateHtml( | 122 const std::string full_html = jstemplate_builder::GetI18nTemplateHtml( |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 | 275 |
| 276 SlideshowUI::SlideshowUI(TabContents* contents) : WebUI(contents) { | 276 SlideshowUI::SlideshowUI(TabContents* contents) : WebUI(contents) { |
| 277 SlideshowHandler* handler = new SlideshowHandler(); | 277 SlideshowHandler* handler = new SlideshowHandler(); |
| 278 AddMessageHandler((handler)->Attach(this)); | 278 AddMessageHandler((handler)->Attach(this)); |
| 279 handler->Init(); | 279 handler->Init(); |
| 280 SlideshowUIHTMLSource* html_source = new SlideshowUIHTMLSource(); | 280 SlideshowUIHTMLSource* html_source = new SlideshowUIHTMLSource(); |
| 281 | 281 |
| 282 // Set up the chrome://slideshow/ source. | 282 // Set up the chrome://slideshow/ source. |
| 283 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); | 283 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); |
| 284 } | 284 } |
| OLD | NEW |