| 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 "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/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/profiles/profile_manager.h" | 10 #include "chrome/browser/profiles/profile_manager.h" |
| 11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
| 12 #include "chrome/browser/ui/browser_list.h" | 12 #include "chrome/browser/ui/browser_list.h" |
| 13 #include "chrome/browser/ui/browser_tabstrip.h" |
| 14 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 13 #include "chrome/common/chrome_paths.h" | 15 #include "chrome/common/chrome_paths.h" |
| 14 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
| 17 #include "content/public/browser/web_contents.h" |
| 18 #include "content/public/common/url_constants.h" |
| 15 #include "grit/devtools_discovery_page_resources.h" | 19 #include "grit/devtools_discovery_page_resources.h" |
| 16 #include "net/url_request/url_request_context_getter.h" | 20 #include "net/url_request/url_request_context_getter.h" |
| 17 #include "ui/base/layout.h" | 21 #include "ui/base/layout.h" |
| 18 #include "ui/base/resource/resource_bundle.h" | 22 #include "ui/base/resource/resource_bundle.h" |
| 19 | 23 |
| 20 using content::DevToolsHttpHandlerDelegate; | 24 using content::DevToolsHttpHandlerDelegate; |
| 25 using content::RenderViewHost; |
| 21 | 26 |
| 22 BrowserListTabContentsProvider::BrowserListTabContentsProvider() { | 27 BrowserListTabContentsProvider::BrowserListTabContentsProvider() { |
| 23 } | 28 } |
| 24 | 29 |
| 25 BrowserListTabContentsProvider::~BrowserListTabContentsProvider() { | 30 BrowserListTabContentsProvider::~BrowserListTabContentsProvider() { |
| 26 } | 31 } |
| 27 | 32 |
| 28 std::string BrowserListTabContentsProvider::GetDiscoveryPageHTML() { | 33 std::string BrowserListTabContentsProvider::GetDiscoveryPageHTML() { |
| 29 std::set<Profile*> profiles; | 34 std::set<Profile*> profiles; |
| 30 for (BrowserList::const_iterator it = BrowserList::begin(), | 35 for (BrowserList::const_iterator it = BrowserList::begin(), |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 if (!top_sites) | 77 if (!top_sites) |
| 73 continue; | 78 continue; |
| 74 scoped_refptr<base::RefCountedMemory> data; | 79 scoped_refptr<base::RefCountedMemory> data; |
| 75 if (top_sites->GetPageThumbnail(url, &data)) | 80 if (top_sites->GetPageThumbnail(url, &data)) |
| 76 return std::string( | 81 return std::string( |
| 77 reinterpret_cast<const char*>(data->front()), data->size()); | 82 reinterpret_cast<const char*>(data->front()), data->size()); |
| 78 } | 83 } |
| 79 | 84 |
| 80 return std::string(); | 85 return std::string(); |
| 81 } | 86 } |
| 87 |
| 88 RenderViewHost* BrowserListTabContentsProvider::CreateNewTarget() { |
| 89 for (BrowserList::const_iterator it = BrowserList::begin(), |
| 90 end = BrowserList::end(); it != end; ++it) { |
| 91 TabContents* tab_contents = chrome::AddSelectedTabWithURL( |
| 92 *it, |
| 93 GURL(chrome::kAboutBlankURL), |
| 94 content::PAGE_TRANSITION_LINK); |
| 95 return tab_contents->web_contents()->GetRenderViewHost(); |
| 96 } |
| 97 return NULL; |
| 98 } |
| OLD | NEW |