Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(199)

Side by Side Diff: chrome/browser/android/devtools_server.cc

Issue 10985041: DevTools: request page thumbnails from the devtools handler delegate, do not redirect to chrome://t… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Android delegate updated. Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/debugger/browser_list_tabcontents_provider.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/android/devtools_server.h" 5 #include "chrome/browser/android/devtools_server.h"
6 6
7 #include <cstring> 7 #include <cstring>
8 #include <pwd.h> 8 #include <pwd.h>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 } 50 }
51 51
52 virtual bool BundlesFrontendResources() { 52 virtual bool BundlesFrontendResources() {
53 return false; 53 return false;
54 } 54 }
55 55
56 virtual std::string GetFrontendResourcesBaseURL() { 56 virtual std::string GetFrontendResourcesBaseURL() {
57 return ""; 57 return "";
58 } 58 }
59 59
60 virtual std::string GetPageThumbnailData(const GURL& url) {
61 Profile* profile =
62 ProfileManager::GetLastUsedProfile()->GetOriginalProfile();
63 history::TopSites* top_sites = profile->GetTopSites();
64 if (top_sites) {
65 scoped_refptr<base::RefCountedMemory> data;
66 if (top_sites->GetPageThumbnail(url, &data))
67 return std::string(reinterpret_cast<const char*>(data->front()),
68 data->size());
69 }
70 return "";
71 }
72
60 private: 73 private:
61 static void PopulatePageThumbnails() { 74 static void PopulatePageThumbnails() {
62 Profile* profile = 75 Profile* profile =
63 ProfileManager::GetLastUsedProfile()->GetOriginalProfile(); 76 ProfileManager::GetLastUsedProfile()->GetOriginalProfile();
64 history::TopSites* top_sites = profile->GetTopSites(); 77 history::TopSites* top_sites = profile->GetTopSites();
65 if (top_sites) 78 if (top_sites)
66 top_sites->SyncWithHistory(); 79 top_sites->SyncWithHistory();
67 } 80 }
68 81
69 DISALLOW_COPY_AND_ASSIGN(DevToolsServerDelegate); 82 DISALLOW_COPY_AND_ASSIGN(DevToolsServerDelegate);
(...skipping 29 matching lines...) Expand all
99 return; 112 return;
100 // Note that the call to Stop() below takes care of |protocol_handler_| 113 // Note that the call to Stop() below takes care of |protocol_handler_|
101 // deletion. 114 // deletion.
102 protocol_handler_->Stop(); 115 protocol_handler_->Stop();
103 protocol_handler_ = NULL; 116 protocol_handler_ = NULL;
104 } 117 }
105 118
106 bool DevToolsServer::IsStarted() const { 119 bool DevToolsServer::IsStarted() const {
107 return protocol_handler_; 120 return protocol_handler_;
108 } 121 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/debugger/browser_list_tabcontents_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698