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

Side by Side Diff: chrome/browser/debugger/dev_tools_view.cc

Issue 21540: Add developer tools message forwarding to browser (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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/debugger/dev_tools_view.h ('k') | chrome/browser/debugger/dev_tools_window.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/debugger/dev_tools_view.h"
6
7 #include "chrome/browser/browser_list.h"
8 #include "chrome/browser/profile.h"
9 #include "chrome/browser/tab_contents/web_contents.h"
10 #include "chrome/browser/views/tab_contents_container_view.h"
11 #include "chrome/common/property_bag.h"
12 #include "chrome/common/render_messages.h"
13
14 DevToolsView::DevToolsView(int inspected_process_id, int inspected_view_id)
15 : inspected_process_id_(inspected_process_id),
16 inspected_view_id_(inspected_view_id),
17 web_contents_(NULL) {
18 web_container_ = new TabContentsContainerView();
19 AddChildView(web_container_);
20 }
21
22 DevToolsView::~DevToolsView() {
23 }
24
25 void DevToolsView::SendDevToolsClientMessage(const IPC::Message& message) {
26 if (!web_contents_) {
27 NOTREACHED();
28 return;
29 }
30 IPC::Message* copy = new IPC::Message(message);
31 copy->set_routing_id(web_contents_->render_view_host()->routing_id());
32 web_contents_->render_view_host()->Send(copy);
33 }
34
35 std::string DevToolsView::GetClassName() const {
36 return "DevToolsView";
37 }
38
39 gfx::Size DevToolsView::GetPreferredSize() {
40 return gfx::Size(700, 400);
41 }
42
43 void DevToolsView::Layout() {
44 web_container_->SetBounds(0, 0, width(), height());
45 }
46
47 void DevToolsView::ViewHierarchyChanged(bool is_add,
48 views::View* parent,
49 views::View* child) {
50 if (is_add && child == this) {
51 DCHECK(GetWidget());
52 Init();
53 }
54 }
55
56 void DevToolsView::Init() {
57 // We can't create the WebContents until we've actually been put into a real
58 // view hierarchy somewhere.
59 Profile* profile = BrowserList::GetLastActive()->profile();
60
61 TabContents* tc = TabContents::CreateWithType(TAB_CONTENTS_DOM_UI, profile,
62 NULL);
63 web_contents_ = tc->AsWebContents();
64 web_contents_->SetupController(profile);
65 web_contents_->set_delegate(this);
66 web_container_->SetTabContents(web_contents_);
67 web_contents_->render_view_host()->AllowDOMUIBindings();
68 web_contents_->render_view_host()->SetInspectedView(inspected_process_id_,
69 inspected_view_id_);
70
71 GURL contents("chrome-ui://inspector/debugger-oop.html");
72 // this will call CreateRenderView to create renderer process
73 web_contents_->controller()->LoadURL(contents, GURL(),
74 PageTransition::START_PAGE);
75 }
76
77 void DevToolsView::OnWindowClosing() {
78 web_container_->SetTabContents(NULL); // detach last (and only) tab
79 web_contents_->CloseContents(); // destroy the tab and navigation controller
80 }
81
82 void DevToolsView::OpenURLFromTab(TabContents* source,
83 const GURL& url, const GURL& referrer,
84 WindowOpenDisposition disposition,
85 PageTransition::Type transition) {
86 NOTREACHED();
87 }
88
OLDNEW
« no previous file with comments | « chrome/browser/debugger/dev_tools_view.h ('k') | chrome/browser/debugger/dev_tools_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698