Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Side by Side Diff: chrome/browser/devtools/browser_list_tabcontents_provider.cc

Issue 815983002: Topsites become keyedService based. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 5 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_service_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
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 TopSitesServiceFactory::GetForProfile(*it);
58 if (top_sites.get()) {
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698