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

Side by Side Diff: chrome/browser/dom_ui/dom_ui.cc

Issue 6286068: Reland 73532. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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
« no previous file with comments | « chrome/browser/dom_ui/dom_ui.h ('k') | chrome/browser/dom_ui/dom_ui_browsertest.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/dom_ui.h" 5 #include "chrome/browser/dom_ui/dom_ui.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "base/stl_util-inl.h" 9 #include "base/stl_util-inl.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 const std::vector<const Value*>& args) { 119 const std::vector<const Value*>& args) {
120 ExecuteJavascript(GetJavascript(function_name, args)); 120 ExecuteJavascript(GetJavascript(function_name, args));
121 } 121 }
122 122
123 ui::ThemeProvider* DOMUI::GetThemeProvider() const { 123 ui::ThemeProvider* DOMUI::GetThemeProvider() const {
124 return GetProfile()->GetThemeProvider(); 124 return GetProfile()->GetThemeProvider();
125 } 125 }
126 126
127 void DOMUI::RegisterMessageCallback(const std::string &message, 127 void DOMUI::RegisterMessageCallback(const std::string &message,
128 MessageCallback *callback) { 128 MessageCallback *callback) {
129 message_callbacks_.insert(std::make_pair(message, callback)); 129 std::pair<MessageCallbackMap::iterator, bool> result =
130 message_callbacks_.insert(std::make_pair(message, callback));
131
132 // Overwrite preexisting message callback mappings.
133 if (register_callback_overwrites() && !result.second)
134 result.first->second = callback;
130 } 135 }
131 136
132 Profile* DOMUI::GetProfile() const { 137 Profile* DOMUI::GetProfile() const {
133 DCHECK(tab_contents()); 138 DCHECK(tab_contents());
134 return tab_contents()->profile(); 139 return tab_contents()->profile();
135 } 140 }
136 141
137 RenderViewHost* DOMUI::GetRenderViewHost() const { 142 RenderViewHost* DOMUI::GetRenderViewHost() const {
138 DCHECK(tab_contents()); 143 DCHECK(tab_contents());
139 return tab_contents()->render_view_host(); 144 return tab_contents()->render_view_host();
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 } 201 }
197 202
198 // TODO(viettrungluu): convert to string16 (or UTF-8 std::string?). 203 // TODO(viettrungluu): convert to string16 (or UTF-8 std::string?).
199 std::wstring DOMMessageHandler::ExtractStringValue(const ListValue* value) { 204 std::wstring DOMMessageHandler::ExtractStringValue(const ListValue* value) {
200 string16 string16_value; 205 string16 string16_value;
201 if (value->GetString(0, &string16_value)) 206 if (value->GetString(0, &string16_value))
202 return UTF16ToWideHack(string16_value); 207 return UTF16ToWideHack(string16_value);
203 NOTREACHED(); 208 NOTREACHED();
204 return std::wstring(); 209 return std::wstring();
205 } 210 }
OLDNEW
« no previous file with comments | « chrome/browser/dom_ui/dom_ui.h ('k') | chrome/browser/dom_ui/dom_ui_browsertest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698