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

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

Issue 126103003: Changed RefCountedStaticMemory() to accept a void pointer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 10 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
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/dev_tools_server.h" 5 #include "chrome/browser/android/dev_tools_server.h"
6 6
7 #include <pwd.h> 7 #include <pwd.h>
8 #include <cstring> 8 #include <cstring>
9 9
10 #include "base/android/jni_string.h" 10 #include "base/android/jni_string.h"
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 return base::FilePath(); 278 return base::FilePath();
279 } 279 }
280 280
281 virtual std::string GetPageThumbnailData(const GURL& url) OVERRIDE { 281 virtual std::string GetPageThumbnailData(const GURL& url) OVERRIDE {
282 Profile* profile = 282 Profile* profile =
283 ProfileManager::GetLastUsedProfile()->GetOriginalProfile(); 283 ProfileManager::GetLastUsedProfile()->GetOriginalProfile();
284 history::TopSites* top_sites = profile->GetTopSites(); 284 history::TopSites* top_sites = profile->GetTopSites();
285 if (top_sites) { 285 if (top_sites) {
286 scoped_refptr<base::RefCountedMemory> data; 286 scoped_refptr<base::RefCountedMemory> data;
287 if (top_sites->GetPageThumbnail(url, false, &data)) 287 if (top_sites->GetPageThumbnail(url, false, &data))
288 return std::string(reinterpret_cast<const char*>(data->front()), 288 return std::string(data->front_as<char>(), data->size());
289 data->size());
290 } 289 }
291 return ""; 290 return "";
292 } 291 }
293 292
294 virtual scoped_ptr<content::DevToolsTarget> CreateNewTarget( 293 virtual scoped_ptr<content::DevToolsTarget> CreateNewTarget(
295 const GURL& url) OVERRIDE { 294 const GURL& url) OVERRIDE {
296 Profile* profile = ProfileManager::GetActiveUserProfile(); 295 Profile* profile = ProfileManager::GetActiveUserProfile();
297 TabModel* tab_model = TabModelList::GetTabModelWithProfile(profile); 296 TabModel* tab_model = TabModelList::GetTabModelWithProfile(profile);
298 if (!tab_model) 297 if (!tab_model)
299 return scoped_ptr<content::DevToolsTarget>(); 298 return scoped_ptr<content::DevToolsTarget>();
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 jobject obj, 461 jobject obj,
463 jint server, 462 jint server,
464 jboolean enabled) { 463 jboolean enabled) {
465 DevToolsServer* devtools_server = reinterpret_cast<DevToolsServer*>(server); 464 DevToolsServer* devtools_server = reinterpret_cast<DevToolsServer*>(server);
466 if (enabled) { 465 if (enabled) {
467 devtools_server->Start(); 466 devtools_server->Start();
468 } else { 467 } else {
469 devtools_server->Stop(); 468 devtools_server->Stop();
470 } 469 }
471 } 470 }
OLDNEW
« no previous file with comments | « base/memory/ref_counted_memory_unittest.cc ('k') | chrome/browser/bookmarks/bookmark_html_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698