| OLD | NEW | 
|---|
| 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 "chrome/browser/ui/webui/inspect_ui.h" | 5 #include "chrome/browser/ui/webui/inspect_ui.h" | 
| 6 | 6 | 
| 7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" | 
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" | 
| 9 #include "chrome/browser/devtools/devtools_target_impl.h" | 9 #include "chrome/browser/devtools/devtools_target_impl.h" | 
| 10 #include "chrome/browser/devtools/devtools_targets_ui.h" | 10 #include "chrome/browser/devtools/devtools_targets_ui.h" | 
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 51 | 51 | 
| 52 const char kPortForwardingDefaultPort[] = "8080"; | 52 const char kPortForwardingDefaultPort[] = "8080"; | 
| 53 const char kPortForwardingDefaultLocation[] = "localhost:8080"; | 53 const char kPortForwardingDefaultLocation[] = "localhost:8080"; | 
| 54 | 54 | 
| 55 // InspectMessageHandler -------------------------------------------- | 55 // InspectMessageHandler -------------------------------------------- | 
| 56 | 56 | 
| 57 class InspectMessageHandler : public WebUIMessageHandler { | 57 class InspectMessageHandler : public WebUIMessageHandler { | 
| 58  public: | 58  public: | 
| 59   explicit InspectMessageHandler(InspectUI* inspect_ui) | 59   explicit InspectMessageHandler(InspectUI* inspect_ui) | 
| 60       : inspect_ui_(inspect_ui) {} | 60       : inspect_ui_(inspect_ui) {} | 
| 61   virtual ~InspectMessageHandler() {} | 61   ~InspectMessageHandler() override {} | 
| 62 | 62 | 
| 63  private: | 63  private: | 
| 64   // WebUIMessageHandler implementation. | 64   // WebUIMessageHandler implementation. | 
| 65   virtual void RegisterMessages() override; | 65   void RegisterMessages() override; | 
| 66 | 66 | 
| 67   void HandleInitUICommand(const base::ListValue* args); | 67   void HandleInitUICommand(const base::ListValue* args); | 
| 68   void HandleInspectCommand(const base::ListValue* args); | 68   void HandleInspectCommand(const base::ListValue* args); | 
| 69   void HandleActivateCommand(const base::ListValue* args); | 69   void HandleActivateCommand(const base::ListValue* args); | 
| 70   void HandleCloseCommand(const base::ListValue* args); | 70   void HandleCloseCommand(const base::ListValue* args); | 
| 71   void HandleReloadCommand(const base::ListValue* args); | 71   void HandleReloadCommand(const base::ListValue* args); | 
| 72   void HandleOpenCommand(const base::ListValue* args); | 72   void HandleOpenCommand(const base::ListValue* args); | 
| 73   void HandleInspectBrowserCommand(const base::ListValue* args); | 73   void HandleInspectBrowserCommand(const base::ListValue* args); | 
| 74   void HandleBooleanPrefChanged(const char* pref_name, | 74   void HandleBooleanPrefChanged(const char* pref_name, | 
| 75                                 const base::ListValue* args); | 75                                 const base::ListValue* args); | 
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 199     profile->GetPrefs()->Set(prefs::kDevToolsPortForwardingConfig, *dict_src); | 199     profile->GetPrefs()->Set(prefs::kDevToolsPortForwardingConfig, *dict_src); | 
| 200 } | 200 } | 
| 201 | 201 | 
| 202 // DevToolsUIBindingsEnabler ---------------------------------------- | 202 // DevToolsUIBindingsEnabler ---------------------------------------- | 
| 203 | 203 | 
| 204 class DevToolsUIBindingsEnabler | 204 class DevToolsUIBindingsEnabler | 
| 205     : public content::WebContentsObserver { | 205     : public content::WebContentsObserver { | 
| 206  public: | 206  public: | 
| 207   DevToolsUIBindingsEnabler(WebContents* web_contents, | 207   DevToolsUIBindingsEnabler(WebContents* web_contents, | 
| 208                             const GURL& url); | 208                             const GURL& url); | 
| 209   virtual ~DevToolsUIBindingsEnabler() {} | 209   ~DevToolsUIBindingsEnabler() override {} | 
| 210 | 210 | 
| 211   DevToolsUIBindings* GetBindings(); | 211   DevToolsUIBindings* GetBindings(); | 
| 212 | 212 | 
| 213  private: | 213  private: | 
| 214   // contents::WebContentsObserver overrides. | 214   // contents::WebContentsObserver overrides. | 
| 215   virtual void WebContentsDestroyed() override; | 215   void WebContentsDestroyed() override; | 
| 216   virtual void AboutToNavigateRenderView( | 216   void AboutToNavigateRenderView( | 
| 217       content::RenderViewHost* render_view_host) override; | 217       content::RenderViewHost* render_view_host) override; | 
| 218 | 218 | 
| 219   DevToolsUIBindings bindings_; | 219   DevToolsUIBindings bindings_; | 
| 220   GURL url_; | 220   GURL url_; | 
| 221   DISALLOW_COPY_AND_ASSIGN(DevToolsUIBindingsEnabler); | 221   DISALLOW_COPY_AND_ASSIGN(DevToolsUIBindingsEnabler); | 
| 222 }; | 222 }; | 
| 223 | 223 | 
| 224 DevToolsUIBindingsEnabler::DevToolsUIBindingsEnabler( | 224 DevToolsUIBindingsEnabler::DevToolsUIBindingsEnabler( | 
| 225     WebContents* web_contents, | 225     WebContents* web_contents, | 
| 226     const GURL& url) | 226     const GURL& url) | 
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 526     handler->ForceUpdate(); | 526     handler->ForceUpdate(); | 
| 527 } | 527 } | 
| 528 | 528 | 
| 529 void InspectUI::PopulatePortStatus(const base::Value& status) { | 529 void InspectUI::PopulatePortStatus(const base::Value& status) { | 
| 530   web_ui()->CallJavascriptFunction("populatePortStatus", status); | 530   web_ui()->CallJavascriptFunction("populatePortStatus", status); | 
| 531 } | 531 } | 
| 532 | 532 | 
| 533 void InspectUI::ShowIncognitoWarning() { | 533 void InspectUI::ShowIncognitoWarning() { | 
| 534   web_ui()->CallJavascriptFunction("showIncognitoWarning"); | 534   web_ui()->CallJavascriptFunction("showIncognitoWarning"); | 
| 535 } | 535 } | 
| OLD | NEW | 
|---|