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

Side by Side Diff: chrome/browser/ui/webui/options/options_ui.cc

Issue 13945023: Make URLDataSource::GetSource() const. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: And another one. Created 7 years, 8 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/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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 // OptionsUIHTMLSource 104 // OptionsUIHTMLSource
105 // 105 //
106 //////////////////////////////////////////////////////////////////////////////// 106 ////////////////////////////////////////////////////////////////////////////////
107 107
108 class OptionsUIHTMLSource : public content::URLDataSource { 108 class OptionsUIHTMLSource : public content::URLDataSource {
109 public: 109 public:
110 // The constructor takes over ownership of |localized_strings|. 110 // The constructor takes over ownership of |localized_strings|.
111 explicit OptionsUIHTMLSource(DictionaryValue* localized_strings); 111 explicit OptionsUIHTMLSource(DictionaryValue* localized_strings);
112 112
113 // content::URLDataSource implementation. 113 // content::URLDataSource implementation.
114 virtual std::string GetSource() OVERRIDE; 114 virtual std::string GetSource() const OVERRIDE;
115 virtual void StartDataRequest( 115 virtual void StartDataRequest(
116 const std::string& path, 116 const std::string& path,
117 bool is_incognito, 117 bool is_incognito,
118 const content::URLDataSource::GotDataCallback& callback) OVERRIDE; 118 const content::URLDataSource::GotDataCallback& callback) OVERRIDE;
119 virtual std::string GetMimeType(const std::string&) const OVERRIDE; 119 virtual std::string GetMimeType(const std::string&) const OVERRIDE;
120 virtual bool ShouldDenyXFrameOptions() const OVERRIDE; 120 virtual bool ShouldDenyXFrameOptions() const OVERRIDE;
121 121
122 private: 122 private:
123 virtual ~OptionsUIHTMLSource(); 123 virtual ~OptionsUIHTMLSource();
124 124
125 // Localized strings collection. 125 // Localized strings collection.
126 scoped_ptr<DictionaryValue> localized_strings_; 126 scoped_ptr<DictionaryValue> localized_strings_;
127 127
128 DISALLOW_COPY_AND_ASSIGN(OptionsUIHTMLSource); 128 DISALLOW_COPY_AND_ASSIGN(OptionsUIHTMLSource);
129 }; 129 };
130 130
131 OptionsUIHTMLSource::OptionsUIHTMLSource(DictionaryValue* localized_strings) { 131 OptionsUIHTMLSource::OptionsUIHTMLSource(DictionaryValue* localized_strings) {
132 DCHECK(localized_strings); 132 DCHECK(localized_strings);
133 localized_strings_.reset(localized_strings); 133 localized_strings_.reset(localized_strings);
134 } 134 }
135 135
136 std::string OptionsUIHTMLSource::GetSource() { 136 std::string OptionsUIHTMLSource::GetSource() const {
137 return chrome::kChromeUISettingsFrameHost; 137 return chrome::kChromeUISettingsFrameHost;
138 } 138 }
139 139
140 void OptionsUIHTMLSource::StartDataRequest( 140 void OptionsUIHTMLSource::StartDataRequest(
141 const std::string& path, 141 const std::string& path,
142 bool is_incognito, 142 bool is_incognito,
143 const content::URLDataSource::GotDataCallback& callback) { 143 const content::URLDataSource::GotDataCallback& callback) {
144 scoped_refptr<base::RefCountedMemory> response_bytes; 144 scoped_refptr<base::RefCountedMemory> response_bytes;
145 webui::SetFontAndTextDirection(localized_strings_.get()); 145 webui::SetFontAndTextDirection(localized_strings_.get());
146 146
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 // Add only if handler's service is enabled. 423 // Add only if handler's service is enabled.
424 if (handler->IsEnabled()) { 424 if (handler->IsEnabled()) {
425 // Add handler to the list and also pass the ownership. 425 // Add handler to the list and also pass the ownership.
426 web_ui()->AddMessageHandler(handler.release()); 426 web_ui()->AddMessageHandler(handler.release());
427 handler_raw->GetLocalizedValues(localized_strings); 427 handler_raw->GetLocalizedValues(localized_strings);
428 handlers_.push_back(handler_raw); 428 handlers_.push_back(handler_raw);
429 } 429 }
430 } 430 }
431 431
432 } // namespace options 432 } // namespace options
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/chromeos/user_image_source.cc ('k') | chrome/browser/ui/webui/screenshot_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698