diff options
Diffstat (limited to 'chrome/browser/debugger')
-rw-r--r-- | chrome/browser/debugger/debugger_host_impl.cpp | 9 | ||||
-rw-r--r-- | chrome/browser/debugger/debugger_node.cc | 54 | ||||
-rw-r--r-- | chrome/browser/debugger/debugger_node.h | 10 | ||||
-rw-r--r-- | chrome/browser/debugger/debugger_remote_service.cc | 32 | ||||
-rw-r--r-- | chrome/browser/debugger/debugger_remote_service.h | 4 | ||||
-rw-r--r-- | chrome/browser/debugger/debugger_view.cc | 23 | ||||
-rw-r--r-- | chrome/browser/debugger/debugger_view.h | 4 | ||||
-rw-r--r-- | chrome/browser/debugger/devtools_manager.cc | 15 | ||||
-rw-r--r-- | chrome/browser/debugger/devtools_protocol_handler.h | 1 | ||||
-rw-r--r-- | chrome/browser/debugger/devtools_view.cc | 32 | ||||
-rw-r--r-- | chrome/browser/debugger/devtools_view.h | 4 |
11 files changed, 87 insertions, 101 deletions
diff --git a/chrome/browser/debugger/debugger_host_impl.cpp b/chrome/browser/debugger/debugger_host_impl.cpp index 1f98f4b8..c9bfa21 100644 --- a/chrome/browser/debugger/debugger_host_impl.cpp +++ b/chrome/browser/debugger/debugger_host_impl.cpp @@ -10,7 +10,7 @@ #include "chrome/browser/debugger/debugger_io.h" #include "chrome/browser/debugger/debugger_wrapper.h" #include "chrome/browser/renderer_host/render_view_host.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/notification_service.h" class TabContentsReference : public NotificationObserver { @@ -134,12 +134,7 @@ void DebuggerHostImpl::OnDebuggerHostMsg(const ListValue* args) { NOTREACHED(); return; } - const WebContents* web = t->AsWebContents(); - if (web == NULL) { - NOTREACHED(); - return; - } - RenderViewHost* host = web->render_view_host(); + RenderViewHost* host = t->render_view_host(); if (methodName == L"attach") { host->DebugAttach(); diff --git a/chrome/browser/debugger/debugger_node.cc b/chrome/browser/debugger/debugger_node.cc index 0beedce..3322500 100644 --- a/chrome/browser/debugger/debugger_node.cc +++ b/chrome/browser/debugger/debugger_node.cc @@ -11,7 +11,7 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/renderer_host/render_process_host.h" #include "chrome/browser/renderer_host/render_view_host.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/debugger/debugger_shell.h" #include "chrome/common/notification_service.h" @@ -19,8 +19,8 @@ DebuggerNode::DebuggerNode() : data_(NULL), valid_(true), observing_(false) { } void DebuggerNode::Observe(NotificationType type, - const NotificationSource& source, - const NotificationDetails& details) { + const NotificationSource& source, + const NotificationDetails& details) { StopObserving(); Invalidate(); } @@ -43,12 +43,12 @@ void DebuggerNode::StopObserving(NotificationService *service) { } v8::Handle<v8::Value> DebuggerNode::IndexGetter(uint32_t index, - const v8::AccessorInfo& info) { + const v8::AccessorInfo& info) { return v8::Undefined(); } v8::Handle<v8::Value> DebuggerNode::PropGetter(v8::Handle<v8::String> prop, - const v8::AccessorInfo& info) { + const v8::AccessorInfo& info) { return v8::Undefined(); } @@ -318,8 +318,8 @@ TabContents* TabNode::GetTab() { } v8::Handle<v8::Value> TabNode::SendToDebugger(const v8::Arguments& args, - WebContents* web) { - RenderViewHost* host = web->render_view_host(); + TabContents* tab) { + RenderViewHost* host = tab->render_view_host(); if (args.Length() == 1) { std::wstring cmd; v8::Handle<v8::Value> obj; @@ -331,24 +331,24 @@ v8::Handle<v8::Value> TabNode::SendToDebugger(const v8::Arguments& args, } v8::Handle<v8::Value> TabNode::Attach(const v8::Arguments& args, - WebContents* web) { - RenderViewHost* host = web->render_view_host(); + TabContents* tab) { + RenderViewHost* host = tab->render_view_host(); host->DebugAttach(); RenderProcessHost* proc = host->process(); return v8::Int32::New(proc->process().pid()); } v8::Handle<v8::Value> TabNode::Detach(const v8::Arguments& args, - WebContents* web) { - RenderViewHost* host = web->render_view_host(); + TabContents* tab) { + RenderViewHost* host = tab->render_view_host(); host->DebugDetach(); RenderProcessHost* proc = host->process(); return v8::Int32::New(proc->process().pid()); } v8::Handle<v8::Value> TabNode::Break(const v8::Arguments& args, - WebContents* web) { - RenderViewHost* host = web->render_view_host(); + TabContents* tab) { + RenderViewHost* host = tab->render_view_host(); bool force = false; if (args.Length() >= 1) { force = args[0]->BooleanValue(); @@ -359,29 +359,27 @@ v8::Handle<v8::Value> TabNode::Break(const v8::Arguments& args, v8::Handle<v8::Value> TabNode::PropGetter(v8::Handle<v8::String> prop, const v8::AccessorInfo& info) { - TabContents* t = GetTab(); - if (t != NULL) { - WebContents* web = t->AsWebContents(); + TabContents* tab = GetTab(); + if (tab != NULL) { if (prop->Equals(v8::String::New("title"))) { - std::wstring title = UTF16ToWideHack(t->GetTitle()); - std::string title2 = WideToUTF8(title); - return v8::String::New(title2.c_str()); - } else if (web) { + std::string title = UTF16ToUTF8(tab->GetTitle()); + return v8::String::New(title.c_str()); + } else { if (prop->Equals(v8::String::New("attach"))) { - FunctionNode<WebContents>* f = - new FunctionNode<WebContents>(TabNode::Attach, web); + FunctionNode<TabContents>* f = + new FunctionNode<TabContents>(TabNode::Attach, tab); return f->NewInstance(); } else if (prop->Equals(v8::String::New("detach"))) { - FunctionNode<WebContents>* f = - new FunctionNode<WebContents>(TabNode::Detach, web); + FunctionNode<TabContents>* f = + new FunctionNode<TabContents>(TabNode::Detach, tab); return f->NewInstance(); } else if (prop->Equals(v8::String::New("sendToDebugger"))) { - FunctionNode<WebContents>* f = - new FunctionNode<WebContents>(TabNode::SendToDebugger, web); + FunctionNode<TabContents>* f = + new FunctionNode<TabContents>(TabNode::SendToDebugger, tab); return f->NewInstance(); } else if (prop->Equals(v8::String::New("debugBreak"))) { - FunctionNode<WebContents>* f = - new FunctionNode<WebContents>(TabNode::Break, web); + FunctionNode<TabContents>* f = + new FunctionNode<TabContents>(TabNode::Break, tab); return f->NewInstance(); } } diff --git a/chrome/browser/debugger/debugger_node.h b/chrome/browser/debugger/debugger_node.h index 0a38cd5..f62a006 100644 --- a/chrome/browser/debugger/debugger_node.h +++ b/chrome/browser/debugger/debugger_node.h @@ -23,7 +23,7 @@ class Browser; class TabContents; class DebuggerShell; class NotificationService; -class WebContents; +class TabContents; class DebuggerNode : public NotificationObserver { public: @@ -201,13 +201,13 @@ class TabNode : public DebuggerNode { private: static v8::Handle<v8::Value> SendToDebugger(const v8::Arguments& args, - WebContents* data); + TabContents* data); static v8::Handle<v8::Value> Attach(const v8::Arguments& args, - WebContents* data); + TabContents* data); static v8::Handle<v8::Value> Detach(const v8::Arguments& args, - WebContents* data); + TabContents* data); static v8::Handle<v8::Value> Break(const v8::Arguments& args, - WebContents* data); + TabContents* data); virtual ~TabNode(); TabContents* GetTab(); diff --git a/chrome/browser/debugger/debugger_remote_service.cc b/chrome/browser/debugger/debugger_remote_service.cc index a856fb6..729dc8a 100644 --- a/chrome/browser/debugger/debugger_remote_service.cc +++ b/chrome/browser/debugger/debugger_remote_service.cc @@ -13,7 +13,7 @@ #include "chrome/browser/debugger/devtools_protocol_handler.h" #include "chrome/browser/debugger/devtools_remote_message.h" #include "chrome/browser/debugger/inspectable_tab_proxy.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/devtools_messages.h" #include "chrome/common/render_messages.h" @@ -83,10 +83,10 @@ void DebuggerRemoteService::HandleMessage( if (manager == NULL) { response.SetInteger(kResultWide, Result::kDebuggerError); } - WebContents* web_contents = ToWebContents(tab_uid); - if (web_contents != NULL) { + TabContents* tab_contents = ToTabContents(tab_uid); + if (tab_contents != NULL) { DevToolsClientHost* client_host = - manager->GetDevToolsClientHostFor(*web_contents); + manager->GetDevToolsClientHostFor(*tab_contents); if (client_host != NULL) { std::string v8_command; DictionaryValue* v8_command_value; @@ -111,9 +111,9 @@ void DebuggerRemoteService::HandleMessage( } } else if (command == DebuggerRemoteServiceCommand::kEvaluateJavascript) { if (tab_uid != -1) { - WebContents* web_contents = ToWebContents(tab_uid); - if (web_contents != NULL) { - RenderViewHost* rvh = web_contents->render_view_host(); + TabContents* tab_contents = ToTabContents(tab_uid); + if (tab_contents != NULL) { + RenderViewHost* rvh = tab_contents->render_view_host(); if (rvh != NULL) { std::wstring javascript; content->GetString(kDataWide, &javascript); @@ -156,7 +156,7 @@ void DebuggerRemoteService::SendResponse(const Value& response, delegate_->Send(*response_message.get()); } -WebContents* DebuggerRemoteService::ToWebContents(int32 tab_uid) { +TabContents* DebuggerRemoteService::ToTabContents(int32 tab_uid) { const InspectableTabProxy::ControllersMap& navcon_map = delegate_->inspectable_tab_proxy()->controllers_map(); InspectableTabProxy::ControllersMap::const_iterator it = @@ -166,7 +166,7 @@ WebContents* DebuggerRemoteService::ToWebContents(int32 tab_uid) { if (tab_contents == NULL) { return NULL; } else { - return tab_contents->AsWebContents(); + return tab_contents; } } else { return NULL; @@ -207,19 +207,19 @@ void DebuggerRemoteService::AttachTab(const std::string& destination, response->SetInteger(kResultWide, Result::kUnknownTab); return; } - WebContents* web_contents = ToWebContents(tab_uid); - if (web_contents == NULL) { + TabContents* tab_contents = ToTabContents(tab_uid); + if (tab_contents == NULL) { // No active web contents with tab_uid response->SetInteger(kResultWide, Result::kUnknownTab); return; } if (g_browser_process->devtools_manager()->GetDevToolsClientHostFor( - *web_contents) == NULL) { + *tab_contents) == NULL) { DevToolsClientHost* client_host = delegate_->inspectable_tab_proxy()->NewClientHost(tab_uid, this); DevToolsManager* manager = g_browser_process->devtools_manager(); if (manager != NULL) { - manager->RegisterDevToolsClientHostFor(*web_contents, client_host); + manager->RegisterDevToolsClientHostFor(*tab_contents, client_host); manager->ForwardToDevToolsAgent(*client_host, DevToolsAgentMsg_Attach()); response->SetInteger(kResultWide, Result::kOk); } else { @@ -243,15 +243,15 @@ void DebuggerRemoteService::DetachTab(const std::string& destination, } return; } - WebContents* web_contents = ToWebContents(tab_uid); - if (web_contents == NULL) { + TabContents* tab_contents = ToTabContents(tab_uid); + if (tab_contents == NULL) { // Unknown tab resultCode = Result::kUnknownTab; } else { DevToolsManager* manager = g_browser_process->devtools_manager(); if (manager != NULL) { DevToolsClientHost* client_host = - manager->GetDevToolsClientHostFor(*web_contents); + manager->GetDevToolsClientHostFor(*tab_contents); if (client_host != NULL) { manager->ForwardToDevToolsAgent( *client_host, DevToolsAgentMsg_Detach()); diff --git a/chrome/browser/debugger/debugger_remote_service.h b/chrome/browser/debugger/debugger_remote_service.h index 53d06ba..7b2b683 100644 --- a/chrome/browser/debugger/debugger_remote_service.h +++ b/chrome/browser/debugger/debugger_remote_service.h @@ -16,7 +16,7 @@ class DevToolsProtocolHandler; class DevToolsRemoteMessage; class DictionaryValue; class Value; -class WebContents; +class TabContents; // Contains constants for DebuggerRemoteService tool protocol commands // (only V8-related). @@ -63,7 +63,7 @@ class DebuggerRemoteService : public DevToolsRemoteListener { void AttachTab(const std::string& destination, DictionaryValue* response); - WebContents* ToWebContents(int32 tab_uid); + TabContents* ToTabContents(int32 tab_uid); void SendResponse(const Value& response, const std::string& tool, const std::string& destination); diff --git a/chrome/browser/debugger/debugger_view.cc b/chrome/browser/debugger/debugger_view.cc index c292b39..bf3dc09 100644 --- a/chrome/browser/debugger/debugger_view.cc +++ b/chrome/browser/debugger/debugger_view.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/debugger/debugger_window.h" +#include "chrome/browser/debugger/debugger_view.h" #include "base/logging.h" #include "base/string_util.h" @@ -11,7 +11,7 @@ #include "chrome/browser/browser_list.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/debugger/debugger_shell.h" -#include "chrome/browser/debugger/debugger_view.h" +#include "chrome/browser/debugger/debugger_window.h" #include "chrome/browser/debugger/debugger_wrapper.h" #include "chrome/browser/dom_ui/chrome_url_data_manager.h" #include "chrome/browser/renderer_host/render_view_host.h" @@ -19,7 +19,6 @@ #include "chrome/browser/view_ids.h" #include "chrome/browser/views/standard_layout.h" #include "chrome/browser/views/tab_contents_container_view.h" -#include "chrome/browser/tab_contents/web_contents.h" #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/resource_bundle.h" #include "chrome/views/grid_layout.h" @@ -96,27 +95,27 @@ void DebuggerView::Output(const std::wstring& out) { } void DebuggerView::OnInit() { - // We can't create the WebContents until we've actually been put into a real + // We can't create the TabContents until we've actually been put into a real // view hierarchy somewhere. Profile* profile = BrowserList::GetLastActive()->profile(); - web_contents_ = new WebContents(profile, NULL, MSG_ROUTING_NONE, NULL); + tab_contents_ = new TabContents(profile, NULL, MSG_ROUTING_NONE, NULL); - web_contents_->set_delegate(this); - web_container_->SetTabContents(web_contents_); - web_contents_->render_view_host()->AllowDOMUIBindings(); + tab_contents_->set_delegate(this); + web_container_->SetTabContents(tab_contents_); + tab_contents_->render_view_host()->AllowDOMUIBindings(); GURL contents("chrome-ui://inspector/debugger.html"); - web_contents_->controller().LoadURL(contents, GURL(), + tab_contents_->controller().LoadURL(contents, GURL(), PageTransition::START_PAGE); } void DebuggerView::OnShow() { - web_contents_->Focus(); + tab_contents_->Focus(); } void DebuggerView::OnClose() { web_container_->SetTabContents(NULL); - delete web_contents_; + delete tab_contents_; } void DebuggerView::OpenURLFromTab(TabContents* source, @@ -149,7 +148,7 @@ void DebuggerView::SendEventToPage(const std::wstring& name, } void DebuggerView::ExecuteJavascript(const std::string& js) { - web_contents_->render_view_host()->ExecuteJavascriptInWebFrame(L"", + tab_contents_->render_view_host()->ExecuteJavascriptInWebFrame(L"", UTF8ToWide(js)); } diff --git a/chrome/browser/debugger/debugger_view.h b/chrome/browser/debugger/debugger_view.h index 7707713..616afce 100644 --- a/chrome/browser/debugger/debugger_view.h +++ b/chrome/browser/debugger/debugger_view.h @@ -17,9 +17,9 @@ class DebuggerView; class DebuggerWindow; +class TabContents; class TabContentsContainerView; class Value; -class WebContents; class DebuggerView : public views::View, public TabContentsDelegate { @@ -89,7 +89,7 @@ class DebuggerView : public views::View, DebuggerWindow* window_; ChromeFont font_; - WebContents* web_contents_; + TabContents* tab_contents_; TabContentsContainerView* web_container_; std::vector<std::wstring> pending_output_; std::vector<std::string> pending_events_; diff --git a/chrome/browser/debugger/devtools_manager.cc b/chrome/browser/debugger/devtools_manager.cc index b18b9af..3ebfbd3 100644 --- a/chrome/browser/debugger/devtools_manager.cc +++ b/chrome/browser/debugger/devtools_manager.cc @@ -8,7 +8,6 @@ #include "chrome/browser/debugger/devtools_client_host.h" #include "chrome/browser/renderer_host/render_view_host.h" #include "chrome/browser/tab_contents/tab_contents.h" -#include "chrome/browser/tab_contents/web_contents.h" #include "chrome/common/devtools_messages.h" #include "chrome/common/notification_registrar.h" #include "chrome/common/notification_type.h" @@ -26,9 +25,9 @@ DevToolsManager::~DevToolsManager() { void DevToolsManager::Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::WEB_CONTENTS_DISCONNECTED); + DCHECK(type == NotificationType::TAB_CONTENTS_DISCONNECTED); - if (type == NotificationType::WEB_CONTENTS_DISCONNECTED) { + if (type == NotificationType::TAB_CONTENTS_DISCONNECTED) { Source<TabContents> src(source); DevToolsClientHost* client_host = GetDevToolsClientHostFor(*src.ptr()); if (!client_host) { @@ -111,12 +110,8 @@ void DevToolsManager::ForwardToDevToolsAgent(const DevToolsClientHost& from, void DevToolsManager::ForwardToDevToolsClient(const RenderViewHost& from, const IPC::Message& message) { - TabContents* wc = from.delegate()->GetAsWebContents(); - if (!wc) { - NOTREACHED(); - return; - } - DevToolsClientHost* target_host = GetDevToolsClientHostFor(*wc); + TabContents* tc = from.delegate()->GetAsTabContents(); + DevToolsClientHost* target_host = GetDevToolsClientHostFor(*tc); if (!target_host) { // Client window was closed while there were messages // being sent to it. @@ -187,7 +182,7 @@ void DevToolsManager::StartListening( tab_contents_listeners_.reset(new NotificationRegistrar); tab_contents_listeners_->Add( this, - NotificationType::WEB_CONTENTS_DISCONNECTED, + NotificationType::TAB_CONTENTS_DISCONNECTED, NotificationService::AllSources()); } } diff --git a/chrome/browser/debugger/devtools_protocol_handler.h b/chrome/browser/debugger/devtools_protocol_handler.h index 7080794..7b4c7fd 100644 --- a/chrome/browser/debugger/devtools_protocol_handler.h +++ b/chrome/browser/debugger/devtools_protocol_handler.h @@ -16,7 +16,6 @@ class InspectableTabProxy; class DevToolsRemoteListenSocket; class DevToolsRemoteMessage; -class WebContents; // Dispatches DevToolsRemoteMessages to their appropriate handlers (Tools) // based on the value of the Tool message header. diff --git a/chrome/browser/debugger/devtools_view.cc b/chrome/browser/debugger/devtools_view.cc index 179eb7e..34cbb20 100644 --- a/chrome/browser/debugger/devtools_view.cc +++ b/chrome/browser/debugger/devtools_view.cc @@ -9,13 +9,13 @@ #include "chrome/browser/browser_list.h" #include "chrome/browser/debugger/devtools_client_host.h" #include "chrome/browser/profile.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/views/tab_contents_container_view.h" #include "chrome/common/property_bag.h" #include "chrome/common/render_messages.h" #include "chrome/common/url_constants.h" -DevToolsView::DevToolsView() : web_contents_(NULL) { +DevToolsView::DevToolsView() : tab_contents_(NULL) { web_container_ = new TabContentsContainerView(); AddChildView(web_container_); } @@ -45,38 +45,38 @@ void DevToolsView::ViewHierarchyChanged(bool is_add, } void DevToolsView::Init() { - // We can't create the WebContents until we've actually been put into a real + // We can't create the TabContents until we've actually been put into a real // view hierarchy somewhere. Profile* profile = BrowserList::GetLastActive()->profile(); - web_contents_ = new WebContents(profile, NULL, MSG_ROUTING_NONE, NULL); - web_contents_->set_delegate(this); - web_container_->SetTabContents(web_contents_); - web_contents_->render_view_host()->AllowDOMUIBindings(); + tab_contents_ = new TabContents(profile, NULL, MSG_ROUTING_NONE, NULL); + tab_contents_->set_delegate(this); + web_container_->SetTabContents(tab_contents_); + tab_contents_->render_view_host()->AllowDOMUIBindings(); // chrome-ui://devtools/devtools.html GURL contents(std::string(chrome::kChromeUIDevToolsURL) + "devtools.html"); // this will call CreateRenderView to create renderer process - web_contents_->controller().LoadURL(contents, GURL(), + tab_contents_->controller().LoadURL(contents, GURL(), PageTransition::START_PAGE); } void DevToolsView::OnWindowClosing() { - DCHECK(web_contents_) << "OnWindowClosing is called twice"; - if (web_contents_) { + DCHECK(tab_contents_) << "OnWindowClosing is called twice"; + if (tab_contents_) { // Detach last (and only) tab. web_container_->SetTabContents(NULL); // Destroy the tab and navigation controller. - delete web_contents_; - web_contents_ = NULL; + delete tab_contents_; + tab_contents_ = NULL; } } void DevToolsView::SendMessageToClient(const IPC::Message& message) { - if (web_contents_) { - RenderViewHost* target_host = web_contents_->render_view_host(); + if (tab_contents_) { + RenderViewHost* target_host = tab_contents_->render_view_host(); IPC::Message* m = new IPC::Message(message); m->set_routing_id(target_host->routing_id()); target_host->Send(m); @@ -84,8 +84,8 @@ void DevToolsView::SendMessageToClient(const IPC::Message& message) { } bool DevToolsView::HasRenderViewHost(const RenderViewHost& rvh) const { - if (web_contents_) { - return (&rvh == web_contents_->render_view_host()); + if (tab_contents_) { + return (&rvh == tab_contents_->render_view_host()); } return false; } diff --git a/chrome/browser/debugger/devtools_view.h b/chrome/browser/debugger/devtools_view.h index 0836ccc..39de03b 100644 --- a/chrome/browser/debugger/devtools_view.h +++ b/chrome/browser/debugger/devtools_view.h @@ -18,7 +18,7 @@ class Message; class RenderViewHost; class TabContentsContainerView; -class WebContents; +class TabContents; class DevToolsView : public views::View, public TabContentsDelegate { @@ -67,7 +67,7 @@ class DevToolsView : public views::View, void Init(); - WebContents* web_contents_; + TabContents* tab_contents_; TabContentsContainerView* web_container_; DISALLOW_COPY_AND_ASSIGN(DevToolsView); |