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

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

Issue 14039004: Add int params to URLDataSource::StartDataRequest(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: It's not called a renderder. 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
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() const 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 int render_process_id,
118 int render_view_id,
118 const content::URLDataSource::GotDataCallback& callback) OVERRIDE; 119 const content::URLDataSource::GotDataCallback& callback) OVERRIDE;
119 virtual std::string GetMimeType(const std::string&) const OVERRIDE; 120 virtual std::string GetMimeType(const std::string&) const OVERRIDE;
120 virtual bool ShouldDenyXFrameOptions() const OVERRIDE; 121 virtual bool ShouldDenyXFrameOptions() const OVERRIDE;
121 122
122 private: 123 private:
123 virtual ~OptionsUIHTMLSource(); 124 virtual ~OptionsUIHTMLSource();
124 125
125 // Localized strings collection. 126 // Localized strings collection.
126 scoped_ptr<DictionaryValue> localized_strings_; 127 scoped_ptr<DictionaryValue> localized_strings_;
127 128
128 DISALLOW_COPY_AND_ASSIGN(OptionsUIHTMLSource); 129 DISALLOW_COPY_AND_ASSIGN(OptionsUIHTMLSource);
129 }; 130 };
130 131
131 OptionsUIHTMLSource::OptionsUIHTMLSource(DictionaryValue* localized_strings) { 132 OptionsUIHTMLSource::OptionsUIHTMLSource(DictionaryValue* localized_strings) {
132 DCHECK(localized_strings); 133 DCHECK(localized_strings);
133 localized_strings_.reset(localized_strings); 134 localized_strings_.reset(localized_strings);
134 } 135 }
135 136
136 std::string OptionsUIHTMLSource::GetSource() const { 137 std::string OptionsUIHTMLSource::GetSource() const {
137 return chrome::kChromeUISettingsFrameHost; 138 return chrome::kChromeUISettingsFrameHost;
138 } 139 }
139 140
140 void OptionsUIHTMLSource::StartDataRequest( 141 void OptionsUIHTMLSource::StartDataRequest(
141 const std::string& path, 142 const std::string& path,
142 bool is_incognito, 143 int render_process_id,
144 int render_view_id,
143 const content::URLDataSource::GotDataCallback& callback) { 145 const content::URLDataSource::GotDataCallback& callback) {
144 scoped_refptr<base::RefCountedMemory> response_bytes; 146 scoped_refptr<base::RefCountedMemory> response_bytes;
145 webui::SetFontAndTextDirection(localized_strings_.get()); 147 webui::SetFontAndTextDirection(localized_strings_.get());
146 148
147 if (path == kLocalizedStringsFile) { 149 if (path == kLocalizedStringsFile) {
148 // Return dynamically-generated strings from memory. 150 // Return dynamically-generated strings from memory.
149 webui::UseVersion2 version; 151 webui::UseVersion2 version;
150 std::string strings_js; 152 std::string strings_js;
151 webui::AppendJsonJS(localized_strings_.get(), &strings_js); 153 webui::AppendJsonJS(localized_strings_.get(), &strings_js);
152 response_bytes = base::RefCountedString::TakeString(&strings_js); 154 response_bytes = base::RefCountedString::TakeString(&strings_js);
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 // Add only if handler's service is enabled. 425 // Add only if handler's service is enabled.
424 if (handler->IsEnabled()) { 426 if (handler->IsEnabled()) {
425 // Add handler to the list and also pass the ownership. 427 // Add handler to the list and also pass the ownership.
426 web_ui()->AddMessageHandler(handler.release()); 428 web_ui()->AddMessageHandler(handler.release());
427 handler_raw->GetLocalizedValues(localized_strings); 429 handler_raw->GetLocalizedValues(localized_strings);
428 handlers_.push_back(handler_raw); 430 handlers_.push_back(handler_raw);
429 } 431 }
430 } 432 }
431 433
432 } // namespace options 434 } // 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