| 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 <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 using content::RenderViewHost; | 58 using content::RenderViewHost; |
| 59 using content::RenderViewHostDelegate; | 59 using content::RenderViewHostDelegate; |
| 60 using content::RenderWidgetHost; | 60 using content::RenderWidgetHost; |
| 61 using content::WebContents; | 61 using content::WebContents; |
| 62 using content::WebUIMessageHandler; | 62 using content::WebUIMessageHandler; |
| 63 using content::WorkerService; | 63 using content::WorkerService; |
| 64 using content::WorkerServiceObserver; | 64 using content::WorkerServiceObserver; |
| 65 | 65 |
| 66 namespace { | 66 namespace { |
| 67 | 67 |
| 68 static const char kDataFile[] = "targets-data.json"; | 68 const char kAppTargetType[] = "app"; |
| 69 static const char kAdbPages[] = "adb-pages"; | 69 const char kExtensionTargetType[] = "extension"; |
| 70 const char kPageTargetType[] = "page"; |
| 71 const char kWorkerTargetType[] = "worker"; |
| 72 const char kAdbTargetType[] = "adb_page"; |
| 70 | 73 |
| 71 static const char kAppTargetType[] = "app"; | 74 const char kInitUICommand[] = "init-ui"; |
| 72 static const char kExtensionTargetType[] = "extension"; | 75 const char kInspectCommand[] = "inspect"; |
| 73 static const char kPageTargetType[] = "page"; | 76 const char kActivateCommand[] = "activate"; |
| 74 static const char kWorkerTargetType[] = "worker"; | 77 const char kTerminateCommand[] = "terminate"; |
| 75 static const char kAdbTargetType[] = "adb_page"; | 78 const char kReloadCommand[] = "reload"; |
| 79 const char kOpenCommand[] = "open"; |
| 76 | 80 |
| 77 static const char kInitUICommand[] = "init-ui"; | 81 const char kPortForwardingEnabledCommand[] = |
| 78 static const char kInspectCommand[] = "inspect"; | 82 "set-port-forwarding-enabled"; |
| 79 static const char kActivateCommand[] = "activate"; | 83 const char kPortForwardingConfigCommand[] = "set-port-forwarding-config"; |
| 80 static const char kTerminateCommand[] = "terminate"; | |
| 81 static const char kReloadCommand[] = "reload"; | |
| 82 static const char kOpenCommand[] = "open"; | |
| 83 | 84 |
| 84 static const char kPortForwardingEnabledCommand[] = | 85 const char kPortForwardingDefaultPort[] = "8080"; |
| 85 "set-port-forwarding-enabled"; | 86 const char kPortForwardingDefaultLocation[] = "localhost:8080"; |
| 86 static const char kPortForwardingConfigCommand[] = "set-port-forwarding-config"; | |
| 87 | 87 |
| 88 static const char kPortForwardingDefaultPort[] = "8080"; | 88 const char kTargetTypeField[] = "type"; |
| 89 static const char kPortForwardingDefaultLocation[] = "localhost:8080"; | 89 const char kAttachedField[] = "attached"; |
| 90 | 90 const char kProcessIdField[] = "processId"; |
| 91 static const char kTargetTypeField[] = "type"; | 91 const char kRouteIdField[] = "routeId"; |
| 92 static const char kAttachedField[] = "attached"; | 92 const char kUrlField[] = "url"; |
| 93 static const char kProcessIdField[] = "processId"; | 93 const char kNameField[] = "name"; |
| 94 static const char kRouteIdField[] = "routeId"; | 94 const char kFaviconUrlField[] = "faviconUrl"; |
| 95 static const char kUrlField[] = "url"; | 95 const char kDescription[] = "description"; |
| 96 static const char kNameField[] = "name"; | 96 const char kPidField[] = "pid"; |
| 97 static const char kFaviconUrlField[] = "faviconUrl"; | 97 const char kAdbSerialField[] = "adbSerial"; |
| 98 static const char kDescription[] = "description"; | 98 const char kAdbModelField[] = "adbModel"; |
| 99 static const char kPidField[] = "pid"; | 99 const char kAdbBrowserProductField[] = "adbBrowserProduct"; |
| 100 static const char kAdbSerialField[] = "adbSerial"; | 100 const char kAdbBrowserPackageField[] = "adbBrowserPackage"; |
| 101 static const char kAdbModelField[] = "adbModel"; | 101 const char kAdbBrowserVersionField[] = "adbBrowserVersion"; |
| 102 static const char kAdbBrowserProductField[] = "adbBrowserProduct"; | 102 const char kAdbGlobalIdField[] = "adbGlobalId"; |
| 103 static const char kAdbBrowserPackageField[] = "adbBrowserPackage"; | 103 const char kAdbBrowsersField[] = "browsers"; |
| 104 static const char kAdbBrowserVersionField[] = "adbBrowserVersion"; | 104 const char kAdbPagesField[] = "pages"; |
| 105 static const char kAdbGlobalIdField[] = "adbGlobalId"; | 105 const char kAdbPortStatus[] = "adbPortStatus"; |
| 106 static const char kAdbBrowsersField[] = "browsers"; | 106 const char kAdbScreenWidthField[] = "adbScreenWidth"; |
| 107 static const char kAdbPagesField[] = "pages"; | 107 const char kAdbScreenHeightField[] = "adbScreenHeight"; |
| 108 static const char kAdbPortStatus[] = "adbPortStatus"; | 108 const char kGuestList[] = "guests"; |
| 109 static const char kAdbScreenWidthField[] = "adbScreenWidth"; | |
| 110 static const char kAdbScreenHeightField[] = "adbScreenHeight"; | |
| 111 static const char kGuestList[] = "guests"; | |
| 112 | 109 |
| 113 DictionaryValue* BuildTargetDescriptor( | 110 DictionaryValue* BuildTargetDescriptor( |
| 114 const std::string& target_type, | 111 const std::string& target_type, |
| 115 bool attached, | 112 bool attached, |
| 116 const GURL& url, | 113 const GURL& url, |
| 117 const std::string& name, | 114 const std::string& name, |
| 118 const GURL& favicon_url, | 115 const GURL& favicon_url, |
| 119 const std::string& description, | 116 const std::string& description, |
| 120 int process_id, | 117 int process_id, |
| 121 int route_id, | 118 int route_id, |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 base::DictionaryValue default_config; | 791 base::DictionaryValue default_config; |
| 795 default_config.SetString( | 792 default_config.SetString( |
| 796 kPortForwardingDefaultPort, kPortForwardingDefaultLocation); | 793 kPortForwardingDefaultPort, kPortForwardingDefaultLocation); |
| 797 prefs->Set(prefs::kDevToolsPortForwardingConfig, default_config); | 794 prefs->Set(prefs::kDevToolsPortForwardingConfig, default_config); |
| 798 } | 795 } |
| 799 | 796 |
| 800 const base::Value* InspectUI::GetPrefValue(const char* name) { | 797 const base::Value* InspectUI::GetPrefValue(const char* name) { |
| 801 Profile* profile = Profile::FromWebUI(web_ui()); | 798 Profile* profile = Profile::FromWebUI(web_ui()); |
| 802 return profile->GetPrefs()->FindPreference(name)->GetValue(); | 799 return profile->GetPrefs()->FindPreference(name)->GetValue(); |
| 803 } | 800 } |
| OLD | NEW |