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 "chrome/browser/history/top_sites.h" | 8 #include "chrome/browser/history/top_sites.h" |
| 9 #include "chrome/browser/history/top_sites_factory.h" |
9 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
11 #include "chrome/browser/ui/browser_iterator.h" | 12 #include "chrome/browser/ui/browser_iterator.h" |
12 #include "chrome/common/chrome_paths.h" | 13 #include "chrome/common/chrome_paths.h" |
13 #include "grit/browser_resources.h" | 14 #include "grit/browser_resources.h" |
14 #include "ui/base/resource/resource_bundle.h" | 15 #include "ui/base/resource/resource_bundle.h" |
15 | 16 |
16 BrowserListTabContentsProvider::BrowserListTabContentsProvider( | 17 BrowserListTabContentsProvider::BrowserListTabContentsProvider( |
17 chrome::HostDesktopType host_desktop_type) | 18 chrome::HostDesktopType host_desktop_type) |
18 : host_desktop_type_(host_desktop_type) { | 19 : host_desktop_type_(host_desktop_type) { |
19 } | 20 } |
20 | 21 |
21 BrowserListTabContentsProvider::~BrowserListTabContentsProvider() { | 22 BrowserListTabContentsProvider::~BrowserListTabContentsProvider() { |
22 } | 23 } |
23 | 24 |
24 std::string BrowserListTabContentsProvider::GetDiscoveryPageHTML() { | 25 std::string BrowserListTabContentsProvider::GetDiscoveryPageHTML() { |
25 std::set<Profile*> profiles; | 26 std::set<Profile*> profiles; |
26 for (chrome::BrowserIterator it; !it.done(); it.Next()) | 27 for (chrome::BrowserIterator it; !it.done(); it.Next()) |
27 profiles.insert((*it)->profile()); | 28 profiles.insert((*it)->profile()); |
28 | 29 |
29 for (std::set<Profile*>::iterator it = profiles.begin(); | 30 for (std::set<Profile*>::iterator it = profiles.begin(); |
30 it != profiles.end(); ++it) { | 31 it != profiles.end(); ++it) { |
31 history::TopSites* ts = (*it)->GetTopSites(); | 32 scoped_refptr<history::TopSites> ts = TopSitesFactory::GetForProfile(*it); |
32 if (ts) { | 33 if (ts) { |
33 // TopSites updates itself after a delay. Ask TopSites to update itself | 34 // TopSites updates itself after a delay. Ask TopSites to update itself |
34 // when we're about to show the remote debugging landing page. | 35 // when we're about to show the remote debugging landing page. |
35 ts->SyncWithHistory(); | 36 ts->SyncWithHistory(); |
36 } | 37 } |
37 } | 38 } |
38 return ResourceBundle::GetSharedInstance().GetRawDataResource( | 39 return ResourceBundle::GetSharedInstance().GetRawDataResource( |
39 IDR_DEVTOOLS_DISCOVERY_PAGE_HTML).as_string(); | 40 IDR_DEVTOOLS_DISCOVERY_PAGE_HTML).as_string(); |
40 } | 41 } |
41 | 42 |
42 bool BrowserListTabContentsProvider::BundlesFrontendResources() { | 43 bool BrowserListTabContentsProvider::BundlesFrontendResources() { |
43 return true; | 44 return true; |
44 } | 45 } |
45 | 46 |
46 base::FilePath BrowserListTabContentsProvider::GetDebugFrontendDir() { | 47 base::FilePath BrowserListTabContentsProvider::GetDebugFrontendDir() { |
47 #if defined(DEBUG_DEVTOOLS) | 48 #if defined(DEBUG_DEVTOOLS) |
48 base::FilePath inspector_dir; | 49 base::FilePath inspector_dir; |
49 PathService::Get(chrome::DIR_INSPECTOR, &inspector_dir); | 50 PathService::Get(chrome::DIR_INSPECTOR, &inspector_dir); |
50 return inspector_dir; | 51 return inspector_dir; |
51 #else | 52 #else |
52 return base::FilePath(); | 53 return base::FilePath(); |
53 #endif | 54 #endif |
54 } | 55 } |
OLD | NEW |