Make castv2 performance test work.
[chromium-blink-merge.git] / chrome / browser / devtools / browser_list_tabcontents_provider.cc
blob5c4d4f7efb4d5e69b8cd1e6592bb58d9d5e5071d
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() {
20 BrowserListTabContentsProvider::~BrowserListTabContentsProvider() {
23 std::string BrowserListTabContentsProvider::GetDiscoveryPageHTML() {
24 std::set<Profile*> profiles;
25 for (chrome::BrowserIterator it; !it.done(); it.Next())
26 profiles.insert((*it)->profile());
28 for (std::set<Profile*>::iterator it = profiles.begin();
29 it != profiles.end(); ++it) {
30 scoped_refptr<history::TopSites> ts = TopSitesFactory::GetForProfile(*it);
31 if (ts) {
32 // TopSites updates itself after a delay. Ask TopSites to update itself
33 // when we're about to show the remote debugging landing page.
34 ts->SyncWithHistory();
37 return ResourceBundle::GetSharedInstance().GetRawDataResource(
38 IDR_DEVTOOLS_DISCOVERY_PAGE_HTML).as_string();
41 bool BrowserListTabContentsProvider::BundlesFrontendResources() {
42 return true;
45 base::FilePath BrowserListTabContentsProvider::GetDebugFrontendDir() {
46 #if defined(DEBUG_DEVTOOLS)
47 base::FilePath inspector_dir;
48 PathService::Get(chrome::DIR_INSPECTOR, &inspector_dir);
49 return inspector_dir;
50 #else
51 return base::FilePath();
52 #endif