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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 class DevToolsUIBindings::FrontendWebContentsObserver | 229 class DevToolsUIBindings::FrontendWebContentsObserver |
230 : public content::WebContentsObserver { | 230 : public content::WebContentsObserver { |
231 public: | 231 public: |
232 explicit FrontendWebContentsObserver(DevToolsUIBindings* window); | 232 explicit FrontendWebContentsObserver(DevToolsUIBindings* window); |
233 virtual ~FrontendWebContentsObserver(); | 233 virtual ~FrontendWebContentsObserver(); |
234 | 234 |
235 private: | 235 private: |
236 // contents::WebContentsObserver: | 236 // contents::WebContentsObserver: |
237 virtual void AboutToNavigateRenderView( | 237 virtual void AboutToNavigateRenderView( |
238 content::RenderViewHost* render_view_host) OVERRIDE; | 238 content::RenderViewHost* render_view_host) OVERRIDE; |
239 virtual void DocumentOnLoadCompletedInMainFrame(int32 page_id) OVERRIDE; | 239 virtual void DocumentOnLoadCompletedInMainFrame() OVERRIDE; |
240 | 240 |
241 DevToolsUIBindings* devtools_bindings_; | 241 DevToolsUIBindings* devtools_bindings_; |
242 DISALLOW_COPY_AND_ASSIGN(FrontendWebContentsObserver); | 242 DISALLOW_COPY_AND_ASSIGN(FrontendWebContentsObserver); |
243 }; | 243 }; |
244 | 244 |
245 DevToolsUIBindings::FrontendWebContentsObserver::FrontendWebContentsObserver( | 245 DevToolsUIBindings::FrontendWebContentsObserver::FrontendWebContentsObserver( |
246 DevToolsUIBindings* devtools_window) | 246 DevToolsUIBindings* devtools_window) |
247 : WebContentsObserver(devtools_window->web_contents()), | 247 : WebContentsObserver(devtools_window->web_contents()), |
248 devtools_bindings_(devtools_window) { | 248 devtools_bindings_(devtools_window) { |
249 } | 249 } |
250 | 250 |
251 DevToolsUIBindings::FrontendWebContentsObserver:: | 251 DevToolsUIBindings::FrontendWebContentsObserver:: |
252 ~FrontendWebContentsObserver() { | 252 ~FrontendWebContentsObserver() { |
253 } | 253 } |
254 | 254 |
255 void DevToolsUIBindings::FrontendWebContentsObserver::AboutToNavigateRenderView( | 255 void DevToolsUIBindings::FrontendWebContentsObserver::AboutToNavigateRenderView( |
256 content::RenderViewHost* render_view_host) { | 256 content::RenderViewHost* render_view_host) { |
257 content::DevToolsClientHost::SetupDevToolsFrontendClient(render_view_host); | 257 content::DevToolsClientHost::SetupDevToolsFrontendClient(render_view_host); |
258 } | 258 } |
259 | 259 |
260 void DevToolsUIBindings::FrontendWebContentsObserver:: | 260 void DevToolsUIBindings::FrontendWebContentsObserver:: |
261 DocumentOnLoadCompletedInMainFrame(int32 page_id) { | 261 DocumentOnLoadCompletedInMainFrame() { |
262 devtools_bindings_->DocumentOnLoadCompletedInMainFrame(); | 262 devtools_bindings_->DocumentOnLoadCompletedInMainFrame(); |
263 } | 263 } |
264 | 264 |
265 // DevToolsUIBindings --------------------------------------------------------- | 265 // DevToolsUIBindings --------------------------------------------------------- |
266 | 266 |
267 // static | 267 // static |
268 DevToolsUIBindings* DevToolsUIBindings::ForWebContents( | 268 DevToolsUIBindings* DevToolsUIBindings::ForWebContents( |
269 content::WebContents* web_contents) { | 269 content::WebContents* web_contents) { |
270 DevToolsUIBindingsList* instances = g_instances.Pointer(); | 270 DevToolsUIBindingsList* instances = g_instances.Pointer(); |
271 for (DevToolsUIBindingsList::iterator it(instances->begin()); | 271 for (DevToolsUIBindingsList::iterator it(instances->begin()); |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 web_contents_->GetMainFrame()->ExecuteJavaScript(javascript); | 756 web_contents_->GetMainFrame()->ExecuteJavaScript(javascript); |
757 } | 757 } |
758 | 758 |
759 void DevToolsUIBindings::DocumentOnLoadCompletedInMainFrame() { | 759 void DevToolsUIBindings::DocumentOnLoadCompletedInMainFrame() { |
760 // Call delegate first - it seeds importants bit of information. | 760 // Call delegate first - it seeds importants bit of information. |
761 delegate_->OnLoadCompleted(); | 761 delegate_->OnLoadCompleted(); |
762 | 762 |
763 UpdateTheme(); | 763 UpdateTheme(); |
764 AddDevToolsExtensionsToClient(); | 764 AddDevToolsExtensionsToClient(); |
765 } | 765 } |
OLD | NEW |