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/profiles/profile_manager.h" |
9 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/browser_list.h" | 11 #include "chrome/browser/ui/browser_list.h" |
11 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
12 #include "grit/devtools_discovery_page_resources.h" | 13 #include "grit/devtools_discovery_page_resources.h" |
13 #include "net/url_request/url_request_context_getter.h" | 14 #include "net/url_request/url_request_context_getter.h" |
14 #include "ui/base/layout.h" | 15 #include "ui/base/layout.h" |
15 #include "ui/base/resource/resource_bundle.h" | 16 #include "ui/base/resource/resource_bundle.h" |
16 | 17 |
17 using content::DevToolsHttpHandlerDelegate; | 18 using content::DevToolsHttpHandlerDelegate; |
18 | 19 |
(...skipping 29 matching lines...) Expand all Loading... |
48 | 49 |
49 bool BrowserListTabContentsProvider::BundlesFrontendResources() { | 50 bool BrowserListTabContentsProvider::BundlesFrontendResources() { |
50 // We'd like front-end to be served from the WebUI via proxy, hence | 51 // We'd like front-end to be served from the WebUI via proxy, hence |
51 // pretend we don't have it bundled. | 52 // pretend we don't have it bundled. |
52 return false; | 53 return false; |
53 } | 54 } |
54 | 55 |
55 std::string BrowserListTabContentsProvider::GetFrontendResourcesBaseURL() { | 56 std::string BrowserListTabContentsProvider::GetFrontendResourcesBaseURL() { |
56 return "chrome-devtools://devtools/"; | 57 return "chrome-devtools://devtools/"; |
57 } | 58 } |
| 59 |
| 60 std::string BrowserListTabContentsProvider::GetPageThumbnailData( |
| 61 const GURL& url) { |
| 62 for (BrowserList::const_iterator it = BrowserList::begin(), |
| 63 end = BrowserList::end(); it != end; ++it) { |
| 64 Profile* profile = (*it)->profile(); |
| 65 history::TopSites* top_sites = profile->GetTopSites(); |
| 66 if (!top_sites) |
| 67 continue; |
| 68 scoped_refptr<base::RefCountedMemory> data; |
| 69 if (top_sites->GetPageThumbnail(url, &data)) |
| 70 return std::string( |
| 71 reinterpret_cast<const char*>(data->front()), data->size()); |
| 72 } |
| 73 |
| 74 return std::string(); |
| 75 } |
OLD | NEW |