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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 static const char kPidField[] = "pid"; | 98 static const char kPidField[] = "pid"; |
99 static const char kAdbSerialField[] = "adbSerial"; | 99 static const char kAdbSerialField[] = "adbSerial"; |
100 static const char kAdbModelField[] = "adbModel"; | 100 static const char kAdbModelField[] = "adbModel"; |
101 static const char kAdbBrowserProductField[] = "adbBrowserProduct"; | 101 static const char kAdbBrowserProductField[] = "adbBrowserProduct"; |
102 static const char kAdbBrowserPackageField[] = "adbBrowserPackage"; | 102 static const char kAdbBrowserPackageField[] = "adbBrowserPackage"; |
103 static const char kAdbBrowserVersionField[] = "adbBrowserVersion"; | 103 static const char kAdbBrowserVersionField[] = "adbBrowserVersion"; |
104 static const char kAdbGlobalIdField[] = "adbGlobalId"; | 104 static const char kAdbGlobalIdField[] = "adbGlobalId"; |
105 static const char kAdbBrowsersField[] = "browsers"; | 105 static const char kAdbBrowsersField[] = "browsers"; |
106 static const char kAdbPagesField[] = "pages"; | 106 static const char kAdbPagesField[] = "pages"; |
107 static const char kAdbPortStatus[] = "adbPortStatus"; | 107 static const char kAdbPortStatus[] = "adbPortStatus"; |
| 108 static const char kAdbScreenWidthField[] = "adbScreenWidth"; |
| 109 static const char kAdbScreenHeightField[] = "adbScreenHeight"; |
108 static const char kGuestList[] = "guests"; | 110 static const char kGuestList[] = "guests"; |
109 | 111 |
110 DictionaryValue* BuildTargetDescriptor( | 112 DictionaryValue* BuildTargetDescriptor( |
111 const std::string& target_type, | 113 const std::string& target_type, |
112 bool attached, | 114 bool attached, |
113 const GURL& url, | 115 const GURL& url, |
114 const std::string& name, | 116 const std::string& name, |
115 const GURL& favicon_url, | 117 const GURL& favicon_url, |
116 const std::string& description, | 118 const std::string& description, |
117 int process_id, | 119 int process_id, |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 DevToolsAdbBridge::RemotePage* page = it->get(); | 704 DevToolsAdbBridge::RemotePage* page = it->get(); |
703 DictionaryValue* page_data = BuildTargetDescriptor( | 705 DictionaryValue* page_data = BuildTargetDescriptor( |
704 kAdbTargetType, page->attached(), | 706 kAdbTargetType, page->attached(), |
705 GURL(page->url()), page->title(), GURL(page->favicon_url()), | 707 GURL(page->url()), page->title(), GURL(page->favicon_url()), |
706 page->description(), 0, 0); | 708 page->description(), 0, 0); |
707 std::string page_id = base::StringPrintf("page:%s:%s:%s", | 709 std::string page_id = base::StringPrintf("page:%s:%s:%s", |
708 device->serial().c_str(), | 710 device->serial().c_str(), |
709 browser->socket().c_str(), | 711 browser->socket().c_str(), |
710 page->id().c_str()); | 712 page->id().c_str()); |
711 page_data->SetString(kAdbGlobalIdField, page_id); | 713 page_data->SetString(kAdbGlobalIdField, page_id); |
| 714 // Pass the screen size in the page object to make sure that |
| 715 // the caching logic does not prevent the page item from updating |
| 716 // when the screen size changes. |
| 717 gfx::Size screen_size = device->GetScreenSize(); |
| 718 page_data->SetInteger(kAdbScreenWidthField, screen_size.width()); |
| 719 page_data->SetInteger(kAdbScreenHeightField, screen_size.height()); |
712 remote_pages_[page_id] = page; | 720 remote_pages_[page_id] = page; |
713 page_list->Append(page_data); | 721 page_list->Append(page_data); |
714 } | 722 } |
715 browser_list->Append(browser_data); | 723 browser_list->Append(browser_data); |
716 } | 724 } |
717 | 725 |
718 DictionaryValue* port_status_dict = new DictionaryValue(); | 726 DictionaryValue* port_status_dict = new DictionaryValue(); |
719 typedef DevToolsAdbBridge::RemoteDevice::PortStatusMap StatusMap; | 727 typedef DevToolsAdbBridge::RemoteDevice::PortStatusMap StatusMap; |
720 const StatusMap& port_status = device->port_status(); | 728 const StatusMap& port_status = device->port_status(); |
721 for (StatusMap::const_iterator it = port_status.begin(); | 729 for (StatusMap::const_iterator it = port_status.begin(); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
771 base::DictionaryValue default_config; | 779 base::DictionaryValue default_config; |
772 default_config.SetString( | 780 default_config.SetString( |
773 kPortForwardingDefaultPort, kPortForwardingDefaultLocation); | 781 kPortForwardingDefaultPort, kPortForwardingDefaultLocation); |
774 prefs->Set(prefs::kDevToolsPortForwardingConfig, default_config); | 782 prefs->Set(prefs::kDevToolsPortForwardingConfig, default_config); |
775 } | 783 } |
776 | 784 |
777 const base::Value* InspectUI::GetPrefValue(const char* name) { | 785 const base::Value* InspectUI::GetPrefValue(const char* name) { |
778 Profile* profile = Profile::FromWebUI(web_ui()); | 786 Profile* profile = Profile::FromWebUI(web_ui()); |
779 return profile->GetPrefs()->FindPreference(name)->GetValue(); | 787 return profile->GetPrefs()->FindPreference(name)->GetValue(); |
780 } | 788 } |
OLD | NEW |