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/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 Loading... |
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 Loading... |
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 } |
OLD | NEW |