OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_manager_delegate_android.h" | 5 #include "chrome/browser/android/dev_tools_manager_delegate_android.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
11 #include "chrome/browser/android/tab_android.h" | 11 #include "chrome/browser/android/tab_android.h" |
12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
13 #include "chrome/browser/history/top_sites.h" | 13 #include "chrome/browser/history/top_sites.h" |
14 #include "chrome/browser/history/top_sites_service_factory.h" | |
14 #include "chrome/browser/profiles/profile_manager.h" | 15 #include "chrome/browser/profiles/profile_manager.h" |
15 #include "chrome/browser/ui/android/tab_model/tab_model.h" | 16 #include "chrome/browser/ui/android/tab_model/tab_model.h" |
16 #include "chrome/browser/ui/android/tab_model/tab_model_list.h" | 17 #include "chrome/browser/ui/android/tab_model/tab_model_list.h" |
17 #include "content/public/browser/devtools_agent_host.h" | 18 #include "content/public/browser/devtools_agent_host.h" |
18 #include "content/public/browser/devtools_target.h" | 19 #include "content/public/browser/devtools_target.h" |
19 #include "content/public/browser/favicon_status.h" | 20 #include "content/public/browser/favicon_status.h" |
20 #include "content/public/browser/navigation_entry.h" | 21 #include "content/public/browser/navigation_entry.h" |
21 #include "content/public/browser/web_contents.h" | 22 #include "content/public/browser/web_contents.h" |
22 | 23 |
23 using content::DevToolsAgentHost; | 24 using content::DevToolsAgentHost; |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
330 } | 331 } |
331 targets.push_back(new NonTabTarget(*it)); | 332 targets.push_back(new NonTabTarget(*it)); |
332 } | 333 } |
333 | 334 |
334 callback.Run(targets); | 335 callback.Run(targets); |
335 } | 336 } |
336 | 337 |
337 std::string DevToolsManagerDelegateAndroid::GetPageThumbnailData( | 338 std::string DevToolsManagerDelegateAndroid::GetPageThumbnailData( |
338 const GURL& url) { | 339 const GURL& url) { |
339 Profile* profile = ProfileManager::GetLastUsedProfile()->GetOriginalProfile(); | 340 Profile* profile = ProfileManager::GetLastUsedProfile()->GetOriginalProfile(); |
340 history::TopSites* top_sites = profile->GetTopSites(); | 341 scoped_refptr<history::TopSites> top_sites = |
341 if (top_sites) { | 342 TopSitesServiceFactory::GetForProfile(profile); |
343 if (top_sites.get()) { | |
sdefresne
2014/12/29 09:48:14
nit: "if (top_sites)" should work, here and everyw
Jitu( very slow this week)
2014/12/30 10:09:02
Done.
Bernhard Bauer
2015/01/06 11:10:30
This is still not fixed in a *lot* of other places
Bernhard Bauer
2015/01/08 10:22:04
Still not fixed in some places. These are really n
| |
342 scoped_refptr<base::RefCountedMemory> data; | 344 scoped_refptr<base::RefCountedMemory> data; |
343 if (top_sites->GetPageThumbnail(url, false, &data)) | 345 if (top_sites->GetPageThumbnail(url, false, &data)) |
344 return std::string(data->front_as<char>(), data->size()); | 346 return std::string(data->front_as<char>(), data->size()); |
345 } | 347 } |
346 return std::string(); | 348 return std::string(); |
347 } | 349 } |
OLD | NEW |