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/debugger/browser_list_tabcontents_provider.h" | 5 #include "chrome/browser/debugger/browser_list_tabcontents_provider.h" |
6 | 6 |
7 #include "chrome/browser/history/top_sites.h" | 7 #include "chrome/browser/history/top_sites.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/ui/browser_list.h" | 9 #include "chrome/browser/ui/browser_list.h" |
10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
11 #include "grit/devtools_discovery_page_resources.h" | 11 #include "grit/devtools_discovery_page_resources.h" |
12 #include "net/url_request/url_request_context_getter.h" | 12 #include "net/url_request/url_request_context_getter.h" |
13 #include "ui/base/resource/resource_bundle.h" | 13 #include "ui/base/resource/resource_bundle.h" |
| 14 #include "ui/base/resource/resource_handle.h" |
14 | 15 |
15 using content::DevToolsHttpHandlerDelegate; | 16 using content::DevToolsHttpHandlerDelegate; |
16 | 17 |
17 BrowserListTabContentsProvider::BrowserListTabContentsProvider() { | 18 BrowserListTabContentsProvider::BrowserListTabContentsProvider() { |
18 } | 19 } |
19 | 20 |
20 BrowserListTabContentsProvider::~BrowserListTabContentsProvider() { | 21 BrowserListTabContentsProvider::~BrowserListTabContentsProvider() { |
21 } | 22 } |
22 | 23 |
23 std::string BrowserListTabContentsProvider::GetDiscoveryPageHTML() { | 24 std::string BrowserListTabContentsProvider::GetDiscoveryPageHTML() { |
24 std::set<Profile*> profiles; | 25 std::set<Profile*> profiles; |
25 for (BrowserList::const_iterator it = BrowserList::begin(), | 26 for (BrowserList::const_iterator it = BrowserList::begin(), |
26 end = BrowserList::end(); it != end; ++it) { | 27 end = BrowserList::end(); it != end; ++it) { |
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 history::TopSites* ts = (*it)->GetTopSites(); |
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 content::BrowserThread::PostTask( | 36 content::BrowserThread::PostTask( |
36 content::BrowserThread::UI, | 37 content::BrowserThread::UI, |
37 FROM_HERE, | 38 FROM_HERE, |
38 base::Bind(&history::TopSites::SyncWithHistory, | 39 base::Bind(&history::TopSites::SyncWithHistory, |
39 base::Unretained(ts))); | 40 base::Unretained(ts))); |
40 } | 41 } |
41 } | 42 } |
42 return ResourceBundle::GetSharedInstance().GetRawDataResource( | 43 return ResourceBundle::GetSharedInstance().GetRawDataResource( |
43 IDR_DEVTOOLS_DISCOVERY_PAGE_HTML).as_string(); | 44 IDR_DEVTOOLS_DISCOVERY_PAGE_HTML, |
| 45 ui::ResourceHandle::kScaleFactorNone).as_string(); |
44 } | 46 } |
45 | 47 |
46 bool BrowserListTabContentsProvider::BundlesFrontendResources() { | 48 bool BrowserListTabContentsProvider::BundlesFrontendResources() { |
47 // We'd like front-end to be served from the WebUI via proxy, hence | 49 // We'd like front-end to be served from the WebUI via proxy, hence |
48 // pretend we don't have it bundled. | 50 // pretend we don't have it bundled. |
49 return false; | 51 return false; |
50 } | 52 } |
51 | 53 |
52 std::string BrowserListTabContentsProvider::GetFrontendResourcesBaseURL() { | 54 std::string BrowserListTabContentsProvider::GetFrontendResourcesBaseURL() { |
53 return "chrome-devtools://devtools/"; | 55 return "chrome-devtools://devtools/"; |
54 } | 56 } |
OLD | NEW |