| 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/devtools/browser_list_tabcontents_provider.h" | 5 #include "chrome/browser/devtools/browser_list_tabcontents_provider.h" |
| 6 | 6 |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "chrome/browser/history/top_sites.h" | 9 #include "chrome/browser/history/top_sites.h" |
| 10 #include "chrome/browser/history/top_sites_factory.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
| 12 #include "chrome/browser/ui/browser_iterator.h" | 13 #include "chrome/browser/ui/browser_iterator.h" |
| 13 #include "chrome/browser/ui/host_desktop.h" | 14 #include "chrome/browser/ui/host_desktop.h" |
| 14 #include "chrome/common/chrome_paths.h" | 15 #include "chrome/common/chrome_paths.h" |
| 15 #include "content/public/common/url_constants.h" | 16 #include "content/public/common/url_constants.h" |
| 16 #include "grit/browser_resources.h" | 17 #include "grit/browser_resources.h" |
| 17 #include "net/base/net_errors.h" | 18 #include "net/base/net_errors.h" |
| 18 #include "net/socket/tcp_server_socket.h" | 19 #include "net/socket/tcp_server_socket.h" |
| 19 #include "net/url_request/url_request_context_getter.h" | 20 #include "net/url_request/url_request_context_getter.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 45 BrowserListTabContentsProvider::~BrowserListTabContentsProvider() { | 46 BrowserListTabContentsProvider::~BrowserListTabContentsProvider() { |
| 46 } | 47 } |
| 47 | 48 |
| 48 std::string BrowserListTabContentsProvider::GetDiscoveryPageHTML() { | 49 std::string BrowserListTabContentsProvider::GetDiscoveryPageHTML() { |
| 49 std::set<Profile*> profiles; | 50 std::set<Profile*> profiles; |
| 50 for (chrome::BrowserIterator it; !it.done(); it.Next()) | 51 for (chrome::BrowserIterator it; !it.done(); it.Next()) |
| 51 profiles.insert((*it)->profile()); | 52 profiles.insert((*it)->profile()); |
| 52 | 53 |
| 53 for (std::set<Profile*>::iterator it = profiles.begin(); | 54 for (std::set<Profile*>::iterator it = profiles.begin(); |
| 54 it != profiles.end(); ++it) { | 55 it != profiles.end(); ++it) { |
| 55 history::TopSites* ts = (*it)->GetTopSites(); | 56 scoped_refptr<history::TopSites> top_sites = |
| 56 if (ts) { | 57 TopSitesFactory::GetForProfile(*it); |
| 58 if (top_sites) { |
| 57 // TopSites updates itself after a delay. Ask TopSites to update itself | 59 // TopSites updates itself after a delay. Ask TopSites to update itself |
| 58 // when we're about to show the remote debugging landing page. | 60 // when we're about to show the remote debugging landing page. |
| 59 ts->SyncWithHistory(); | 61 top_sites->SyncWithHistory(); |
| 60 } | 62 } |
| 61 } | 63 } |
| 62 return ResourceBundle::GetSharedInstance().GetRawDataResource( | 64 return ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 63 IDR_DEVTOOLS_DISCOVERY_PAGE_HTML).as_string(); | 65 IDR_DEVTOOLS_DISCOVERY_PAGE_HTML).as_string(); |
| 64 } | 66 } |
| 65 | 67 |
| 66 bool BrowserListTabContentsProvider::BundlesFrontendResources() { | 68 bool BrowserListTabContentsProvider::BundlesFrontendResources() { |
| 67 return true; | 69 return true; |
| 68 } | 70 } |
| 69 | 71 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 87 last_tethering_port_ = kMinTetheringPort; | 89 last_tethering_port_ = kMinTetheringPort; |
| 88 uint16 port = ++last_tethering_port_; | 90 uint16 port = ++last_tethering_port_; |
| 89 *name = base::IntToString(port); | 91 *name = base::IntToString(port); |
| 90 scoped_ptr<net::TCPServerSocket> socket( | 92 scoped_ptr<net::TCPServerSocket> socket( |
| 91 new net::TCPServerSocket(nullptr, net::NetLog::Source())); | 93 new net::TCPServerSocket(nullptr, net::NetLog::Source())); |
| 92 if (socket->ListenWithAddressAndPort("127.0.0.1", port, kBackLog) != net::OK) | 94 if (socket->ListenWithAddressAndPort("127.0.0.1", port, kBackLog) != net::OK) |
| 93 return scoped_ptr<net::ServerSocket>(); | 95 return scoped_ptr<net::ServerSocket>(); |
| 94 | 96 |
| 95 return socket.Pass(); | 97 return socket.Pass(); |
| 96 } | 98 } |
| OLD | NEW |