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

Side by Side Diff: chrome/browser/automation/testing_automation_provider.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
« no previous file with comments | « chrome/browser/automation/automation_util.cc ('k') | chrome/browser/browser_process_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/automation/testing_automation_provider.h" 5 #include "chrome/browser/automation/testing_automation_provider.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 #include "chrome/browser/lifetime/application_lifetime.h" 67 #include "chrome/browser/lifetime/application_lifetime.h"
68 #include "chrome/browser/notifications/balloon.h" 68 #include "chrome/browser/notifications/balloon.h"
69 #include "chrome/browser/notifications/balloon_collection.h" 69 #include "chrome/browser/notifications/balloon_collection.h"
70 #include "chrome/browser/notifications/balloon_notification_ui_manager.h" 70 #include "chrome/browser/notifications/balloon_notification_ui_manager.h"
71 #include "chrome/browser/notifications/notification.h" 71 #include "chrome/browser/notifications/notification.h"
72 #include "chrome/browser/password_manager/password_store.h" 72 #include "chrome/browser/password_manager/password_store.h"
73 #include "chrome/browser/password_manager/password_store_change.h" 73 #include "chrome/browser/password_manager/password_store_change.h"
74 #include "chrome/browser/password_manager/password_store_factory.h" 74 #include "chrome/browser/password_manager/password_store_factory.h"
75 #include "chrome/browser/platform_util.h" 75 #include "chrome/browser/platform_util.h"
76 #include "chrome/browser/plugins/plugin_prefs.h" 76 #include "chrome/browser/plugins/plugin_prefs.h"
77 #include "chrome/browser/printing/print_preview_dialog_controller.h"
78 #include "chrome/browser/profiles/profile.h" 77 #include "chrome/browser/profiles/profile.h"
79 #include "chrome/browser/profiles/profile_info_cache.h" 78 #include "chrome/browser/profiles/profile_info_cache.h"
80 #include "chrome/browser/profiles/profile_manager.h" 79 #include "chrome/browser/profiles/profile_manager.h"
81 #include "chrome/browser/profiles/profile_window.h" 80 #include "chrome/browser/profiles/profile_window.h"
82 #include "chrome/browser/profiles/profiles_state.h" 81 #include "chrome/browser/profiles/profiles_state.h"
83 #include "chrome/browser/search_engines/template_url.h" 82 #include "chrome/browser/search_engines/template_url.h"
84 #include "chrome/browser/search_engines/template_url_service.h" 83 #include "chrome/browser/search_engines/template_url_service.h"
85 #include "chrome/browser/search_engines/template_url_service_factory.h" 84 #include "chrome/browser/search_engines/template_url_service_factory.h"
86 #include "chrome/browser/sessions/session_service_factory.h" 85 #include "chrome/browser/sessions/session_service_factory.h"
87 #include "chrome/browser/sessions/session_tab_helper.h" 86 #include "chrome/browser/sessions/session_tab_helper.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 158
160 #if defined(OS_MACOSX) 159 #if defined(OS_MACOSX)
161 #include <mach/mach.h> 160 #include <mach/mach.h>
162 #include <mach/mach_vm.h> 161 #include <mach/mach_vm.h>
163 #endif 162 #endif
164 163
165 #if !defined(NO_TCMALLOC) && (defined(OS_LINUX) || defined(OS_CHROMEOS)) 164 #if !defined(NO_TCMALLOC) && (defined(OS_LINUX) || defined(OS_CHROMEOS))
166 #include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h" 165 #include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h"
167 #endif // !defined(NO_TCMALLOC) && (defined(OS_LINUX) || defined(OS_CHROMEOS)) 166 #endif // !defined(NO_TCMALLOC) && (defined(OS_LINUX) || defined(OS_CHROMEOS))
168 167
168 #if defined(ENABLE_FULL_PRINTING)
169 #include "chrome/browser/printing/print_preview_dialog_controller.h"
170 #endif
171
169 using automation::Error; 172 using automation::Error;
170 using automation::ErrorCode; 173 using automation::ErrorCode;
171 using automation_util::SendErrorIfModalDialogActive; 174 using automation_util::SendErrorIfModalDialogActive;
172 using content::BrowserChildProcessHostIterator; 175 using content::BrowserChildProcessHostIterator;
173 using content::BrowserContext; 176 using content::BrowserContext;
174 using content::BrowserThread; 177 using content::BrowserThread;
175 using content::ChildProcessHost; 178 using content::ChildProcessHost;
176 using content::DownloadItem; 179 using content::DownloadItem;
177 using content::DownloadManager; 180 using content::DownloadManager;
178 using content::InterstitialPage; 181 using content::InterstitialPage;
(...skipping 5067 matching lines...) Expand 10 before | Expand all | Expand 10 after
5246 } 5249 }
5247 } 5250 }
5248 DictionaryValue dict; 5251 DictionaryValue dict;
5249 dict.Set("ids", id_list); 5252 dict.Set("ids", id_list);
5250 AutomationJSONReply(this, reply_message).SendSuccess(&dict); 5253 AutomationJSONReply(this, reply_message).SendSuccess(&dict);
5251 } 5254 }
5252 5255
5253 void TestingAutomationProvider::GetViews( 5256 void TestingAutomationProvider::GetViews(
5254 DictionaryValue* args, IPC::Message* reply_message) { 5257 DictionaryValue* args, IPC::Message* reply_message) {
5255 ListValue* view_list = new ListValue(); 5258 ListValue* view_list = new ListValue();
5259 #if defined(ENABLE_FULL_PRINTING)
5256 printing::PrintPreviewDialogController* preview_controller = 5260 printing::PrintPreviewDialogController* preview_controller =
5257 printing::PrintPreviewDialogController::GetInstance(); 5261 printing::PrintPreviewDialogController::GetInstance();
5262 #endif
5258 for (chrome::BrowserIterator it; !it.done(); it.Next()) { 5263 for (chrome::BrowserIterator it; !it.done(); it.Next()) {
5259 Browser* browser = *it; 5264 Browser* browser = *it;
5260 for (int i = 0; i < browser->tab_strip_model()->count(); ++i) { 5265 for (int i = 0; i < browser->tab_strip_model()->count(); ++i) {
5261 WebContents* contents = browser->tab_strip_model()->GetWebContentsAt(i); 5266 WebContents* contents = browser->tab_strip_model()->GetWebContentsAt(i);
5262 DictionaryValue* dict = new DictionaryValue(); 5267 DictionaryValue* dict = new DictionaryValue();
5263 AutomationId id = automation_util::GetIdForTab(contents); 5268 AutomationId id = automation_util::GetIdForTab(contents);
5264 dict->Set("auto_id", id.ToValue()); 5269 dict->Set("auto_id", id.ToValue());
5265 view_list->Append(dict); 5270 view_list->Append(dict);
5271 #if defined(ENABLE_FULL_PRINTING)
5266 if (preview_controller) { 5272 if (preview_controller) {
5267 WebContents* preview_dialog = 5273 WebContents* preview_dialog =
5268 preview_controller->GetPrintPreviewForContents(contents); 5274 preview_controller->GetPrintPreviewForContents(contents);
5269 if (preview_dialog) { 5275 if (preview_dialog) {
5270 DictionaryValue* dict = new DictionaryValue(); 5276 DictionaryValue* dict = new DictionaryValue();
5271 AutomationId id = automation_util::GetIdForTab(preview_dialog); 5277 AutomationId id = automation_util::GetIdForTab(preview_dialog);
5272 dict->Set("auto_id", id.ToValue()); 5278 dict->Set("auto_id", id.ToValue());
5273 view_list->Append(dict); 5279 view_list->Append(dict);
5274 } 5280 }
5275 } 5281 }
5282 #endif
5276 } 5283 }
5277 } 5284 }
5278 5285
5279 ExtensionProcessManager* extension_mgr = 5286 ExtensionProcessManager* extension_mgr =
5280 extensions::ExtensionSystem::Get(profile())->process_manager(); 5287 extensions::ExtensionSystem::Get(profile())->process_manager();
5281 const ExtensionProcessManager::ViewSet all_views = 5288 const ExtensionProcessManager::ViewSet all_views =
5282 extension_mgr->GetAllViews(); 5289 extension_mgr->GetAllViews();
5283 ExtensionProcessManager::ViewSet::const_iterator iter; 5290 ExtensionProcessManager::ViewSet::const_iterator iter;
5284 for (iter = all_views.begin(); iter != all_views.end(); ++iter) { 5291 for (iter = all_views.begin(); iter != all_views.end(); ++iter) {
5285 content::RenderViewHost* host = (*iter); 5292 content::RenderViewHost* host = (*iter);
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
5568 if (g_browser_process) 5575 if (g_browser_process)
5569 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); 5576 g_browser_process->GetAutomationProviderList()->RemoveProvider(this);
5570 } 5577 }
5571 5578
5572 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, 5579 void TestingAutomationProvider::EnsureTabSelected(Browser* browser,
5573 WebContents* tab) { 5580 WebContents* tab) {
5574 TabStripModel* tab_strip = browser->tab_strip_model(); 5581 TabStripModel* tab_strip = browser->tab_strip_model();
5575 if (tab_strip->GetActiveWebContents() != tab) 5582 if (tab_strip->GetActiveWebContents() != tab)
5576 tab_strip->ActivateTabAt(tab_strip->GetIndexOfWebContents(tab), true); 5583 tab_strip->ActivateTabAt(tab_strip->GetIndexOfWebContents(tab), true);
5577 } 5584 }
OLDNEW
« no previous file with comments | « chrome/browser/automation/automation_util.cc ('k') | chrome/browser/browser_process_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698