| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/devtools/devtools_ui_bindings.h" | 5 #include "chrome/browser/devtools/devtools_ui_bindings.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 class DevToolsUIBindings::FrontendWebContentsObserver | 228 class DevToolsUIBindings::FrontendWebContentsObserver |
| 229 : public content::WebContentsObserver { | 229 : public content::WebContentsObserver { |
| 230 public: | 230 public: |
| 231 explicit FrontendWebContentsObserver(DevToolsUIBindings* window); | 231 explicit FrontendWebContentsObserver(DevToolsUIBindings* window); |
| 232 virtual ~FrontendWebContentsObserver(); | 232 virtual ~FrontendWebContentsObserver(); |
| 233 | 233 |
| 234 private: | 234 private: |
| 235 // contents::WebContentsObserver: | 235 // contents::WebContentsObserver: |
| 236 virtual void AboutToNavigateRenderView( | 236 virtual void AboutToNavigateRenderView( |
| 237 content::RenderViewHost* render_view_host) OVERRIDE; | 237 content::RenderViewHost* render_view_host) OVERRIDE; |
| 238 virtual void DocumentOnLoadCompletedInMainFrame(int32 page_id) OVERRIDE; | 238 virtual void DocumentOnLoadCompletedInMainFrame() OVERRIDE; |
| 239 | 239 |
| 240 DevToolsUIBindings* devtools_bindings_; | 240 DevToolsUIBindings* devtools_bindings_; |
| 241 DISALLOW_COPY_AND_ASSIGN(FrontendWebContentsObserver); | 241 DISALLOW_COPY_AND_ASSIGN(FrontendWebContentsObserver); |
| 242 }; | 242 }; |
| 243 | 243 |
| 244 DevToolsUIBindings::FrontendWebContentsObserver::FrontendWebContentsObserver( | 244 DevToolsUIBindings::FrontendWebContentsObserver::FrontendWebContentsObserver( |
| 245 DevToolsUIBindings* devtools_window) | 245 DevToolsUIBindings* devtools_window) |
| 246 : WebContentsObserver(devtools_window->web_contents()), | 246 : WebContentsObserver(devtools_window->web_contents()), |
| 247 devtools_bindings_(devtools_window) { | 247 devtools_bindings_(devtools_window) { |
| 248 } | 248 } |
| 249 | 249 |
| 250 DevToolsUIBindings::FrontendWebContentsObserver:: | 250 DevToolsUIBindings::FrontendWebContentsObserver:: |
| 251 ~FrontendWebContentsObserver() { | 251 ~FrontendWebContentsObserver() { |
| 252 } | 252 } |
| 253 | 253 |
| 254 void DevToolsUIBindings::FrontendWebContentsObserver::AboutToNavigateRenderView( | 254 void DevToolsUIBindings::FrontendWebContentsObserver::AboutToNavigateRenderView( |
| 255 content::RenderViewHost* render_view_host) { | 255 content::RenderViewHost* render_view_host) { |
| 256 content::DevToolsClientHost::SetupDevToolsFrontendClient(render_view_host); | 256 content::DevToolsClientHost::SetupDevToolsFrontendClient(render_view_host); |
| 257 } | 257 } |
| 258 | 258 |
| 259 void DevToolsUIBindings::FrontendWebContentsObserver:: | 259 void DevToolsUIBindings::FrontendWebContentsObserver:: |
| 260 DocumentOnLoadCompletedInMainFrame(int32 page_id) { | 260 DocumentOnLoadCompletedInMainFrame() { |
| 261 devtools_bindings_->DocumentOnLoadCompletedInMainFrame(); | 261 devtools_bindings_->DocumentOnLoadCompletedInMainFrame(); |
| 262 } | 262 } |
| 263 | 263 |
| 264 // DevToolsUIBindings --------------------------------------------------------- | 264 // DevToolsUIBindings --------------------------------------------------------- |
| 265 | 265 |
| 266 // static | 266 // static |
| 267 DevToolsUIBindings* DevToolsUIBindings::ForWebContents( | 267 DevToolsUIBindings* DevToolsUIBindings::ForWebContents( |
| 268 content::WebContents* web_contents) { | 268 content::WebContents* web_contents) { |
| 269 DevToolsUIBindingsList* instances = g_instances.Pointer(); | 269 DevToolsUIBindingsList* instances = g_instances.Pointer(); |
| 270 for (DevToolsUIBindingsList::iterator it(instances->begin()); | 270 for (DevToolsUIBindingsList::iterator it(instances->begin()); |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 web_contents_->GetMainFrame()->ExecuteJavaScript(javascript); | 755 web_contents_->GetMainFrame()->ExecuteJavaScript(javascript); |
| 756 } | 756 } |
| 757 | 757 |
| 758 void DevToolsUIBindings::DocumentOnLoadCompletedInMainFrame() { | 758 void DevToolsUIBindings::DocumentOnLoadCompletedInMainFrame() { |
| 759 // Call delegate first - it seeds importants bit of information. | 759 // Call delegate first - it seeds importants bit of information. |
| 760 delegate_->OnLoadCompleted(); | 760 delegate_->OnLoadCompleted(); |
| 761 | 761 |
| 762 UpdateTheme(); | 762 UpdateTheme(); |
| 763 AddDevToolsExtensionsToClient(); | 763 AddDevToolsExtensionsToClient(); |
| 764 } | 764 } |
| OLD | NEW |