| 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 #ifndef CHROME_BROWSER_UI_WEBUI_INSPECT_UI_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_INSPECT_UI_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_INSPECT_UI_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_INSPECT_UI_H_ |
| 7 | 7 |
| 8 #include <map> |
| 9 |
| 8 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/weak_ptr.h" |
| 12 #include "chrome/browser/devtools/devtools_adb_bridge.h" |
| 9 #include "content/public/browser/notification_observer.h" | 13 #include "content/public/browser/notification_observer.h" |
| 10 #include "content/public/browser/notification_registrar.h" | 14 #include "content/public/browser/notification_registrar.h" |
| 11 #include "content/public/browser/web_ui_controller.h" | 15 #include "content/public/browser/web_ui_controller.h" |
| 16 #include "content/public/browser/web_ui_data_source.h" |
| 12 | 17 |
| 13 class InspectUI : public content::WebUIController, | 18 class InspectUI : public content::WebUIController, |
| 14 public content::NotificationObserver { | 19 public content::NotificationObserver { |
| 15 public: | 20 public: |
| 16 explicit InspectUI(content::WebUI* web_ui); | 21 explicit InspectUI(content::WebUI* web_ui); |
| 17 virtual ~InspectUI(); | 22 virtual ~InspectUI(); |
| 18 | 23 |
| 19 void RefreshUI(); | 24 void RefreshUI(); |
| 20 | 25 |
| 21 private: | 26 private: |
| 22 class WorkerCreationDestructionListener; | 27 class WorkerCreationDestructionListener; |
| 23 | 28 |
| 24 // content::NotificationObserver overrides. | 29 // content::NotificationObserver overrides. |
| 25 virtual void Observe(int type, | 30 virtual void Observe(int type, |
| 26 const content::NotificationSource& source, | 31 const content::NotificationSource& source, |
| 27 const content::NotificationDetails& details) OVERRIDE; | 32 const content::NotificationDetails& details) OVERRIDE; |
| 28 | 33 |
| 29 void StopListeningNotifications(); | 34 void StopListeningNotifications(); |
| 30 | 35 |
| 36 content::WebUIDataSource* CreateInspectUIHTMLSource(); |
| 37 |
| 38 bool HandleRequestCallback( |
| 39 const std::string& path, |
| 40 const content::WebUIDataSource::GotDataCallback& callback); |
| 41 |
| 42 bool HandleAdbQueryCallback( |
| 43 const std::string& path, |
| 44 const content::WebUIDataSource::GotDataCallback& callback); |
| 45 |
| 46 bool HandleLocalXhrCallback( |
| 47 const std::string& path, |
| 48 const content::WebUIDataSource::GotDataCallback& callback); |
| 49 |
| 50 void RespondOnUIThread( |
| 51 const content::WebUIDataSource::GotDataCallback& callback, |
| 52 const std::string& error, |
| 53 const std::string& data); |
| 54 |
| 55 |
| 31 scoped_refptr<WorkerCreationDestructionListener> observer_; | 56 scoped_refptr<WorkerCreationDestructionListener> observer_; |
| 32 | 57 |
| 33 // A scoped container for notification registries. | 58 // A scoped container for notification registries. |
| 34 content::NotificationRegistrar registrar_; | 59 content::NotificationRegistrar registrar_; |
| 35 | 60 |
| 61 scoped_refptr<DevToolsAdbBridge> adb_bridge_; |
| 62 base::WeakPtrFactory<InspectUI> weak_factory_; |
| 63 |
| 36 DISALLOW_COPY_AND_ASSIGN(InspectUI); | 64 DISALLOW_COPY_AND_ASSIGN(InspectUI); |
| 37 }; | 65 }; |
| 38 | 66 |
| 39 #endif // CHROME_BROWSER_UI_WEBUI_INSPECT_UI_H_ | 67 #endif // CHROME_BROWSER_UI_WEBUI_INSPECT_UI_H_ |
| OLD | NEW |