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

Side by Side Diff: chrome/browser/ui/webui/memory_internals/memory_internals_proxy.cc

Issue 22577010: Printing: Add a basic printing mode without print preview and cloud print. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 7 years, 4 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 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/printing/background_printing_manager.h"
21 #include "chrome/browser/profiles/profile.h" 20 #include "chrome/browser/profiles/profile.h"
22 #include "chrome/browser/profiles/profile_manager.h" 21 #include "chrome/browser/profiles/profile_manager.h"
23 #include "chrome/browser/renderer_host/chrome_render_message_filter.h" 22 #include "chrome/browser/renderer_host/chrome_render_message_filter.h"
24 #include "chrome/browser/search/instant_service.h" 23 #include "chrome/browser/search/instant_service.h"
25 #include "chrome/browser/search/instant_service_factory.h" 24 #include "chrome/browser/search/instant_service_factory.h"
26 #include "chrome/browser/ui/android/tab_model/tab_model.h" 25 #include "chrome/browser/ui/android/tab_model/tab_model.h"
27 #include "chrome/browser/ui/android/tab_model/tab_model_list.h" 26 #include "chrome/browser/ui/android/tab_model/tab_model_list.h"
28 #include "chrome/browser/ui/browser.h" 27 #include "chrome/browser/ui/browser.h"
29 #include "chrome/browser/ui/browser_instant_controller.h" 28 #include "chrome/browser/ui/browser_instant_controller.h"
30 #include "chrome/browser/ui/browser_iterator.h" 29 #include "chrome/browser/ui/browser_iterator.h"
31 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" 30 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h"
32 #include "chrome/browser/ui/webui/memory_internals/memory_internals_handler.h" 31 #include "chrome/browser/ui/webui/memory_internals/memory_internals_handler.h"
33 #include "chrome/common/render_messages.h" 32 #include "chrome/common/render_messages.h"
34 #include "content/public/browser/navigation_controller.h" 33 #include "content/public/browser/navigation_controller.h"
35 #include "content/public/browser/navigation_entry.h" 34 #include "content/public/browser/navigation_entry.h"
36 #include "content/public/browser/notification_observer.h" 35 #include "content/public/browser/notification_observer.h"
37 #include "content/public/browser/notification_registrar.h" 36 #include "content/public/browser/notification_registrar.h"
38 #include "content/public/browser/notification_service.h" 37 #include "content/public/browser/notification_service.h"
39 #include "content/public/browser/render_process_host.h" 38 #include "content/public/browser/render_process_host.h"
40 #include "content/public/browser/render_view_host.h" 39 #include "content/public/browser/render_view_host.h"
41 #include "content/public/browser/web_contents.h" 40 #include "content/public/browser/web_contents.h"
42 #include "content/public/browser/web_ui.h" 41 #include "content/public/browser/web_ui.h"
43 42
43 #if defined(ENABLE_FULL_PRINTING)
44 #include "chrome/browser/printing/background_printing_manager.h"
45 #endif
46
44 using content::BrowserThread; 47 using content::BrowserThread;
45 48
46 class Profile; 49 class Profile;
47 50
48 namespace { 51 namespace {
49 52
50 class ProcessDetails : public MemoryDetails { 53 class ProcessDetails : public MemoryDetails {
51 public: 54 public:
52 typedef base::Callback<void(const ProcessData&)> DataCallback; 55 typedef base::Callback<void(const ProcessData&)> DataCallback;
53 explicit ProcessDetails(const DataCallback& callback) 56 explicit ProcessDetails(const DataCallback& callback)
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 for (size_t j = 0; j < contentses.size(); ++j) 110 for (size_t j = 0; j < contentses.size(); ++j)
108 web_contents->insert(contentses[j]); 111 web_contents->insert(contentses[j]);
109 } 112 }
110 // Add all the Instant Extended prerendered NTPs. 113 // Add all the Instant Extended prerendered NTPs.
111 for (size_t i = 0; i < profiles.size(); ++i) { 114 for (size_t i = 0; i < profiles.size(); ++i) {
112 const InstantService* instant_service = 115 const InstantService* instant_service =
113 InstantServiceFactory::GetForProfile(profiles[i]); 116 InstantServiceFactory::GetForProfile(profiles[i]);
114 if (instant_service && instant_service->GetNTPContents()) 117 if (instant_service && instant_service->GetNTPContents())
115 web_contents->insert(instant_service->GetNTPContents()); 118 web_contents->insert(instant_service->GetNTPContents());
116 } 119 }
117 #if !defined(OS_ANDROID) 120 #if defined(ENABLE_FULL_PRINTING)
118 // Add all the pages being background printed. 121 // Add all the pages being background printed.
119 printing::BackgroundPrintingManager* printing_manager = 122 printing::BackgroundPrintingManager* printing_manager =
120 g_browser_process->background_printing_manager(); 123 g_browser_process->background_printing_manager();
121 for (printing::BackgroundPrintingManager::WebContentsSet::const_iterator 124 for (printing::BackgroundPrintingManager::WebContentsSet::const_iterator
122 iter = printing_manager->begin(); 125 iter = printing_manager->begin();
123 iter != printing_manager->end(); ++iter) { 126 iter != printing_manager->end(); ++iter) {
124 web_contents->insert(*iter); 127 web_contents->insert(*iter);
125 } 128 }
126 #endif 129 #endif
127 } 130 }
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 void MemoryInternalsProxy::CallJavaScriptFunctionOnUIThread( 351 void MemoryInternalsProxy::CallJavaScriptFunctionOnUIThread(
349 const std::string& function, const base::Value& args) { 352 const std::string& function, const base::Value& args) {
350 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 353 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
351 354
352 std::vector<const base::Value*> args_vector(1, &args); 355 std::vector<const base::Value*> args_vector(1, &args);
353 string16 update = content::WebUI::GetJavascriptCall(function, args_vector); 356 string16 update = content::WebUI::GetJavascriptCall(function, args_vector);
354 // Don't forward updates to a destructed UI. 357 // Don't forward updates to a destructed UI.
355 if (handler_) 358 if (handler_)
356 handler_->OnUpdate(update); 359 handler_->OnUpdate(update);
357 } 360 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc ('k') | chrome/browser/ui/webui/options/browser_options_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698