OLD | NEW |
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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 void DOMUI::RegisterMessageCallback(const std::string &message, | 124 void DOMUI::RegisterMessageCallback(const std::string &message, |
125 MessageCallback *callback) { | 125 MessageCallback *callback) { |
126 message_callbacks_.insert(std::make_pair(message, callback)); | 126 message_callbacks_.insert(std::make_pair(message, callback)); |
127 } | 127 } |
128 | 128 |
129 Profile* DOMUI::GetProfile() const { | 129 Profile* DOMUI::GetProfile() const { |
130 DCHECK(tab_contents()); | 130 DCHECK(tab_contents()); |
131 return tab_contents()->profile(); | 131 return tab_contents()->profile(); |
132 } | 132 } |
133 | 133 |
| 134 Profile* DOMUI::GetOriginalProfile() const { |
| 135 // Note: GetProfile() is virtual. |
| 136 Profile* profile = GetProfile(); |
| 137 return profile ? profile->GetOriginalProfile() : NULL; |
| 138 } |
| 139 |
134 // DOMUI, protected: ---------------------------------------------------------- | 140 // DOMUI, protected: ---------------------------------------------------------- |
135 | 141 |
136 void DOMUI::AddMessageHandler(DOMMessageHandler* handler) { | 142 void DOMUI::AddMessageHandler(DOMMessageHandler* handler) { |
137 handlers_.push_back(handler); | 143 handlers_.push_back(handler); |
138 } | 144 } |
139 | 145 |
140 RenderViewHost* DOMUI::GetRenderViewHost() const { | 146 RenderViewHost* DOMUI::GetRenderViewHost() const { |
141 DCHECK(tab_contents()); | 147 DCHECK(tab_contents()); |
142 return tab_contents()->render_view_host(); | 148 return tab_contents()->render_view_host(); |
143 } | 149 } |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 } | 201 } |
196 | 202 |
197 // TODO(viettrungluu): convert to string16 (or UTF-8 std::string?). | 203 // TODO(viettrungluu): convert to string16 (or UTF-8 std::string?). |
198 std::wstring DOMMessageHandler::ExtractStringValue(const ListValue* value) { | 204 std::wstring DOMMessageHandler::ExtractStringValue(const ListValue* value) { |
199 string16 string16_value; | 205 string16 string16_value; |
200 if (value->GetString(0, &string16_value)) | 206 if (value->GetString(0, &string16_value)) |
201 return UTF16ToWideHack(string16_value); | 207 return UTF16ToWideHack(string16_value); |
202 NOTREACHED(); | 208 NOTREACHED(); |
203 return std::wstring(); | 209 return std::wstring(); |
204 } | 210 } |
OLD | NEW |