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

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

Issue 126137: Part 1 of merging Extensions and DOMUI (Closed)
Patch Set: add test and rebase Created 11 years, 5 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
« no previous file with comments | « chrome/browser/dom_ui/dom_ui.h ('k') | chrome/browser/dom_ui/dom_ui_factory.cc » ('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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "base/json_reader.h" 8 #include "base/json_reader.h"
9 #include "base/json_writer.h" 9 #include "base/json_writer.h"
10 #include "base/stl_util-inl.h" 10 #include "base/stl_util-inl.h"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "chrome/browser/profile.h" 13 #include "chrome/browser/profile.h"
14 #include "chrome/browser/tab_contents/tab_contents.h" 14 #include "chrome/browser/tab_contents/tab_contents.h"
15 #include "chrome/browser/tab_contents/tab_contents_view.h" 15 #include "chrome/browser/tab_contents/tab_contents_view.h"
16 #include "chrome/common/bindings_policy.h"
16 17
17 DOMUI::DOMUI(TabContents* contents) 18 DOMUI::DOMUI(TabContents* contents)
18 : hide_favicon_(false), 19 : hide_favicon_(false),
19 force_bookmark_bar_visible_(false), 20 force_bookmark_bar_visible_(false),
20 focus_location_bar_by_default_(false), 21 focus_location_bar_by_default_(false),
21 should_hide_url_(false), 22 should_hide_url_(false),
22 link_transition_type_(PageTransition::LINK), 23 link_transition_type_(PageTransition::LINK),
23 tab_contents_(contents) { 24 tab_contents_(contents),
25 bindings_(BindingsPolicy::DOM_UI) {
24 } 26 }
25 27
26 DOMUI::~DOMUI() { 28 DOMUI::~DOMUI() {
27 STLDeleteContainerPairSecondPointers(message_callbacks_.begin(), 29 STLDeleteContainerPairSecondPointers(message_callbacks_.begin(),
28 message_callbacks_.end()); 30 message_callbacks_.end());
29 STLDeleteContainerPointers(handlers_.begin(), handlers_.end()); 31 STLDeleteContainerPointers(handlers_.begin(), handlers_.end());
30 } 32 }
31 33
32 // DOMUI, public: ------------------------------------------------------------- 34 // DOMUI, public: -------------------------------------------------------------
33 35
34 void DOMUI::ProcessDOMUIMessage(const std::string& message, 36 void DOMUI::ProcessDOMUIMessage(const std::string& message,
35 const std::string& content) { 37 const std::string& content,
38 int request_id,
39 bool has_callback) {
36 // Look up the callback for this message. 40 // Look up the callback for this message.
37 MessageCallbackMap::const_iterator callback = 41 MessageCallbackMap::const_iterator callback =
38 message_callbacks_.find(message); 42 message_callbacks_.find(message);
39 if (callback == message_callbacks_.end()) 43 if (callback == message_callbacks_.end())
40 return; 44 return;
41 45
42 // Convert the content JSON into a Value. 46 // Convert the content JSON into a Value.
43 scoped_ptr<Value> value; 47 scoped_ptr<Value> value;
44 if (!content.empty()) { 48 if (!content.empty()) {
45 value.reset(JSONReader::Read(content, false)); 49 value.reset(JSONReader::Read(content, false));
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 list_member->GetType() == Value::TYPE_STRING) { 181 list_member->GetType() == Value::TYPE_STRING) {
178 const StringValue* string_value = 182 const StringValue* string_value =
179 static_cast<const StringValue*>(list_member); 183 static_cast<const StringValue*>(list_member);
180 std::wstring wstring_value; 184 std::wstring wstring_value;
181 string_value->GetAsString(&wstring_value); 185 string_value->GetAsString(&wstring_value);
182 return wstring_value; 186 return wstring_value;
183 } 187 }
184 } 188 }
185 return std::wstring(); 189 return std::wstring();
186 } 190 }
OLDNEW
« no previous file with comments | « chrome/browser/dom_ui/dom_ui.h ('k') | chrome/browser/dom_ui/dom_ui_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698