| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/webui/memory_internals/memory_internals_proxy.h" | 5 #include "chrome/browser/ui/webui/memory_internals/memory_internals_proxy.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
| 13 #include "base/sys_info.h" | 13 #include "base/sys_info.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
| 16 #include "chrome/browser/chrome_notification_types.h" | 16 #include "chrome/browser/chrome_notification_types.h" |
| 17 #include "chrome/browser/memory_details.h" | 17 #include "chrome/browser/memory_details.h" |
| 18 #include "chrome/browser/prerender/prerender_manager.h" | 18 #include "chrome/browser/prerender/prerender_manager.h" |
| 19 #include "chrome/browser/prerender/prerender_manager_factory.h" | 19 #include "chrome/browser/prerender/prerender_manager_factory.h" |
| 20 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
| 21 #include "chrome/browser/profiles/profile_manager.h" | 21 #include "chrome/browser/profiles/profile_manager.h" |
| 22 #include "chrome/browser/renderer_host/chrome_render_message_filter.h" | 22 #include "chrome/browser/renderer_host/chrome_render_message_filter.h" |
| 23 #include "chrome/browser/search/instant_service.h" | |
| 24 #include "chrome/browser/search/instant_service_factory.h" | |
| 25 #include "chrome/browser/ui/android/tab_model/tab_model.h" | 23 #include "chrome/browser/ui/android/tab_model/tab_model.h" |
| 26 #include "chrome/browser/ui/android/tab_model/tab_model_list.h" | 24 #include "chrome/browser/ui/android/tab_model/tab_model_list.h" |
| 27 #include "chrome/browser/ui/browser.h" | 25 #include "chrome/browser/ui/browser.h" |
| 28 #include "chrome/browser/ui/browser_instant_controller.h" | |
| 29 #include "chrome/browser/ui/browser_iterator.h" | 26 #include "chrome/browser/ui/browser_iterator.h" |
| 30 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" | 27 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" |
| 31 #include "chrome/browser/ui/webui/memory_internals/memory_internals_handler.h" | 28 #include "chrome/browser/ui/webui/memory_internals/memory_internals_handler.h" |
| 32 #include "chrome/common/render_messages.h" | 29 #include "chrome/common/render_messages.h" |
| 33 #include "content/public/browser/navigation_controller.h" | 30 #include "content/public/browser/navigation_controller.h" |
| 34 #include "content/public/browser/navigation_entry.h" | 31 #include "content/public/browser/navigation_entry.h" |
| 35 #include "content/public/browser/notification_observer.h" | 32 #include "content/public/browser/notification_observer.h" |
| 36 #include "content/public/browser/notification_registrar.h" | 33 #include "content/public/browser/notification_registrar.h" |
| 37 #include "content/public/browser/notification_service.h" | 34 #include "content/public/browser/notification_service.h" |
| 38 #include "content/public/browser/render_process_host.h" | 35 #include "content/public/browser/render_process_host.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 for (size_t i = 0; i < profiles.size(); ++i) { | 100 for (size_t i = 0; i < profiles.size(); ++i) { |
| 104 prerender::PrerenderManager* prerender_manager = | 101 prerender::PrerenderManager* prerender_manager = |
| 105 prerender::PrerenderManagerFactory::GetForProfile(profiles[i]); | 102 prerender::PrerenderManagerFactory::GetForProfile(profiles[i]); |
| 106 if (!prerender_manager) | 103 if (!prerender_manager) |
| 107 continue; | 104 continue; |
| 108 const std::vector<content::WebContents*> contentses = | 105 const std::vector<content::WebContents*> contentses = |
| 109 prerender_manager->GetAllPrerenderingContents(); | 106 prerender_manager->GetAllPrerenderingContents(); |
| 110 for (size_t j = 0; j < contentses.size(); ++j) | 107 for (size_t j = 0; j < contentses.size(); ++j) |
| 111 web_contents->insert(contentses[j]); | 108 web_contents->insert(contentses[j]); |
| 112 } | 109 } |
| 113 // Add all the Instant Extended prerendered NTPs. | |
| 114 for (size_t i = 0; i < profiles.size(); ++i) { | |
| 115 const InstantService* instant_service = | |
| 116 InstantServiceFactory::GetForProfile(profiles[i]); | |
| 117 if (instant_service && instant_service->GetNTPContents()) | |
| 118 web_contents->insert(instant_service->GetNTPContents()); | |
| 119 } | |
| 120 #if defined(ENABLE_FULL_PRINTING) | 110 #if defined(ENABLE_FULL_PRINTING) |
| 121 // Add all the pages being background printed. | 111 // Add all the pages being background printed. |
| 122 printing::BackgroundPrintingManager* printing_manager = | 112 printing::BackgroundPrintingManager* printing_manager = |
| 123 g_browser_process->background_printing_manager(); | 113 g_browser_process->background_printing_manager(); |
| 124 for (printing::BackgroundPrintingManager::WebContentsSet::const_iterator | 114 for (printing::BackgroundPrintingManager::WebContentsSet::const_iterator |
| 125 iter = printing_manager->begin(); | 115 iter = printing_manager->begin(); |
| 126 iter != printing_manager->end(); ++iter) { | 116 iter != printing_manager->end(); ++iter) { |
| 127 web_contents->insert(*iter); | 117 web_contents->insert(*iter); |
| 128 } | 118 } |
| 129 #endif | 119 #endif |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 const std::string& function, const base::Value& args) { | 342 const std::string& function, const base::Value& args) { |
| 353 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 343 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 354 | 344 |
| 355 std::vector<const base::Value*> args_vector(1, &args); | 345 std::vector<const base::Value*> args_vector(1, &args); |
| 356 base::string16 update = | 346 base::string16 update = |
| 357 content::WebUI::GetJavascriptCall(function, args_vector); | 347 content::WebUI::GetJavascriptCall(function, args_vector); |
| 358 // Don't forward updates to a destructed UI. | 348 // Don't forward updates to a destructed UI. |
| 359 if (handler_) | 349 if (handler_) |
| 360 handler_->OnUpdate(update); | 350 handler_->OnUpdate(update); |
| 361 } | 351 } |
| OLD | NEW |