[Cronet] Delay StartNetLog and StopNetLog until native request context is initialized
[chromium-blink-merge.git] / chrome / browser / devtools / browser_list_tabcontents_provider.cc
blob89255495b8d69f228166434c1abf7c4acba863ef
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
3 // found in the LICENSE file.
5 #include "chrome/browser/devtools/browser_list_tabcontents_provider.h"
7 #include "base/path_service.h"
8 #include "chrome/browser/history/top_sites_factory.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/browser.h"
11 #include "chrome/browser/ui/browser_iterator.h"
12 #include "chrome/common/chrome_paths.h"
13 #include "components/history/core/browser/top_sites.h"
14 #include "grit/browser_resources.h"
15 #include "ui/base/resource/resource_bundle.h"
17 BrowserListTabContentsProvider::BrowserListTabContentsProvider(
18 chrome::HostDesktopType host_desktop_type)
19 : host_desktop_type_(host_desktop_type) {
22 BrowserListTabContentsProvider::~BrowserListTabContentsProvider() {
25 std::string BrowserListTabContentsProvider::GetDiscoveryPageHTML() {
26 std::set<Profile*> profiles;
27 for (chrome::BrowserIterator it; !it.done(); it.Next())
28 profiles.insert((*it)->profile());
30 for (std::set<Profile*>::iterator it = profiles.begin();
31 it != profiles.end(); ++it) {
32 scoped_refptr<history::TopSites> ts = TopSitesFactory::GetForProfile(*it);
33 if (ts) {
34 // TopSites updates itself after a delay. Ask TopSites to update itself
35 // when we're about to show the remote debugging landing page.
36 ts->SyncWithHistory();
39 return ResourceBundle::GetSharedInstance().GetRawDataResource(
40 IDR_DEVTOOLS_DISCOVERY_PAGE_HTML).as_string();
43 bool BrowserListTabContentsProvider::BundlesFrontendResources() {
44 return true;
47 base::FilePath BrowserListTabContentsProvider::GetDebugFrontendDir() {
48 #if defined(DEBUG_DEVTOOLS)
49 base::FilePath inspector_dir;
50 PathService::Get(chrome::DIR_INSPECTOR, &inspector_dir);
51 return inspector_dir;
52 #else
53 return base::FilePath();
54 #endif