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

Side by Side Diff: content/browser/webui/web_ui_impl.cc

Issue 9481008: Move GenericHandler back to Chrome since it was really Chrome specific (i.e. chrome's mapping of cl… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 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 | « content/browser/webui/generic_handler.cc ('k') | content/content_browser.gypi » ('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) 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 "content/browser/webui/web_ui_impl.h" 5 #include "content/browser/webui/web_ui_impl.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "content/browser/child_process_security_policy_impl.h" 12 #include "content/browser/child_process_security_policy_impl.h"
13 #include "content/browser/renderer_host/render_process_host_impl.h" 13 #include "content/browser/renderer_host/render_process_host_impl.h"
14 #include "content/browser/renderer_host/render_view_host.h" 14 #include "content/browser/renderer_host/render_view_host.h"
15 #include "content/browser/tab_contents/tab_contents.h" 15 #include "content/browser/tab_contents/tab_contents.h"
16 #include "content/browser/webui/generic_handler.h"
17 #include "content/common/view_messages.h" 16 #include "content/common/view_messages.h"
18 #include "content/public/browser/web_contents_view.h" 17 #include "content/public/browser/web_contents_view.h"
19 #include "content/public/browser/web_ui_controller.h" 18 #include "content/public/browser/web_ui_controller.h"
19 #include "content/public/browser/web_ui_message_handler.h"
20 #include "content/public/common/bindings_policy.h" 20 #include "content/public/common/bindings_policy.h"
21 #include "ui/base/ui_base_switches.h" 21 #include "ui/base/ui_base_switches.h"
22 22
23 using content::WebContents; 23 using content::WebContents;
24 using content::WebUIController; 24 using content::WebUIController;
25 using content::WebUIMessageHandler; 25 using content::WebUIMessageHandler;
26 26
27 namespace content { 27 namespace content {
28 28
29 const WebUI::TypeID WebUI::kNoWebUI = NULL; 29 const WebUI::TypeID WebUI::kNoWebUI = NULL;
(...skipping 18 matching lines...) Expand all
48 } 48 }
49 49
50 WebUIImpl::WebUIImpl(WebContents* contents) 50 WebUIImpl::WebUIImpl(WebContents* contents)
51 : hide_favicon_(false), 51 : hide_favicon_(false),
52 focus_location_bar_by_default_(false), 52 focus_location_bar_by_default_(false),
53 should_hide_url_(false), 53 should_hide_url_(false),
54 link_transition_type_(content::PAGE_TRANSITION_LINK), 54 link_transition_type_(content::PAGE_TRANSITION_LINK),
55 bindings_(content::BINDINGS_POLICY_WEB_UI), 55 bindings_(content::BINDINGS_POLICY_WEB_UI),
56 web_contents_(contents) { 56 web_contents_(contents) {
57 DCHECK(contents); 57 DCHECK(contents);
58 AddMessageHandler(new GenericHandler());
59 } 58 }
60 59
61 WebUIImpl::~WebUIImpl() { 60 WebUIImpl::~WebUIImpl() {
62 // Delete the controller first, since it may also be keeping a pointer to some 61 // Delete the controller first, since it may also be keeping a pointer to some
63 // of the handlers and can call them at destruction. 62 // of the handlers and can call them at destruction.
64 controller_.reset(); 63 controller_.reset();
65 STLDeleteContainerPointers(handlers_.begin(), handlers_.end()); 64 STLDeleteContainerPointers(handlers_.begin(), handlers_.end());
66 } 65 }
67 66
68 // WebUIImpl, public: ---------------------------------------------------------- 67 // WebUIImpl, public: ----------------------------------------------------------
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 DCHECK(!handler->web_ui()); 256 DCHECK(!handler->web_ui());
258 handler->set_web_ui(this); 257 handler->set_web_ui(this);
259 handler->RegisterMessages(); 258 handler->RegisterMessages();
260 handlers_.push_back(handler); 259 handlers_.push_back(handler);
261 } 260 }
262 261
263 void WebUIImpl::ExecuteJavascript(const string16& javascript) { 262 void WebUIImpl::ExecuteJavascript(const string16& javascript) {
264 web_contents_->GetRenderViewHost()->ExecuteJavascriptInWebFrame( 263 web_contents_->GetRenderViewHost()->ExecuteJavascriptInWebFrame(
265 ASCIIToUTF16(frame_xpath_), javascript); 264 ASCIIToUTF16(frame_xpath_), javascript);
266 } 265 }
OLDNEW
« no previous file with comments | « content/browser/webui/generic_handler.cc ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698