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

Side by Side Diff: chrome/browser/printing/print_dialog_cloud.cc

Issue 8983012: Get rid of content::NavigationController in cc file and use "using" instead. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/printing/print_dialog_cloud.h" 5 #include "chrome/browser/printing/print_dialog_cloud.h"
6 #include "chrome/browser/printing/print_dialog_cloud_internal.h" 6 #include "chrome/browser/printing/print_dialog_cloud_internal.h"
7 7
8 #include "base/base64.h" 8 #include "base/base64.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 // hitting the print button), the delegate is notified, and responds 99 // hitting the print button), the delegate is notified, and responds
100 // that the dialog should be closed, at which point things are torn 100 // that the dialog should be closed, at which point things are torn
101 // down and released. 101 // down and released.
102 102
103 // TODO(scottbyer): 103 // TODO(scottbyer):
104 // http://code.google.com/p/chromium/issues/detail?id=44093 The 104 // http://code.google.com/p/chromium/issues/detail?id=44093 The
105 // high-level flow (where the data is generated before even 105 // high-level flow (where the data is generated before even
106 // bringing up the dialog) isn't what we want. 106 // bringing up the dialog) isn't what we want.
107 107
108 using content::BrowserThread; 108 using content::BrowserThread;
109 using content::NavigationController;
109 using content::NavigationEntry; 110 using content::NavigationEntry;
110 using content::WebContents; 111 using content::WebContents;
111 using content::WebUIMessageHandler; 112 using content::WebUIMessageHandler;
112 113
113 namespace internal_cloud_print_helpers { 114 namespace internal_cloud_print_helpers {
114 115
115 // From the JSON parsed value, get the entries for the page setup 116 // From the JSON parsed value, get the entries for the page setup
116 // parameters. 117 // parameters.
117 bool GetPageSetupParameters(const std::string& json, 118 bool GetPageSetupParameters(const std::string& json,
118 PrintMsg_Print_Params& parameters) { 119 PrintMsg_Print_Params& parameters) {
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 web_ui()->RegisterMessageCallback("SendPrintData", 297 web_ui()->RegisterMessageCallback("SendPrintData",
297 base::Bind(&CloudPrintFlowHandler::HandleSendPrintData, 298 base::Bind(&CloudPrintFlowHandler::HandleSendPrintData,
298 base::Unretained(this))); 299 base::Unretained(this)));
299 web_ui()->RegisterMessageCallback("SetPageParameters", 300 web_ui()->RegisterMessageCallback("SetPageParameters",
300 base::Bind(&CloudPrintFlowHandler::HandleSetPageParameters, 301 base::Bind(&CloudPrintFlowHandler::HandleSetPageParameters,
301 base::Unretained(this))); 302 base::Unretained(this)));
302 303
303 // Register for appropriate notifications, and re-direct the URL 304 // Register for appropriate notifications, and re-direct the URL
304 // to the real server URL, now that we've gotten an HTML dialog 305 // to the real server URL, now that we've gotten an HTML dialog
305 // going. 306 // going.
306 content::NavigationController* controller = 307 NavigationController* controller =
307 &web_ui()->web_contents()->GetController(); 308 &web_ui()->web_contents()->GetController();
308 NavigationEntry* pending_entry = controller->GetPendingEntry(); 309 NavigationEntry* pending_entry = controller->GetPendingEntry();
309 if (pending_entry) { 310 if (pending_entry) {
310 Profile* profile = Profile::FromWebUI(web_ui()); 311 Profile* profile = Profile::FromWebUI(web_ui());
311 pending_entry->SetURL( 312 pending_entry->SetURL(
312 CloudPrintURL(profile).GetCloudPrintServiceDialogURL()); 313 CloudPrintURL(profile).GetCloudPrintServiceDialogURL());
313 } 314 }
314 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, 315 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP,
315 content::Source<content::NavigationController>(controller)); 316 content::Source<NavigationController>(controller));
316 } 317 }
317 318
318 void CloudPrintFlowHandler::Observe( 319 void CloudPrintFlowHandler::Observe(
319 int type, 320 int type,
320 const content::NotificationSource& source, 321 const content::NotificationSource& source,
321 const content::NotificationDetails& details) { 322 const content::NotificationDetails& details) {
322 if (type == content::NOTIFICATION_LOAD_STOP) { 323 if (type == content::NOTIFICATION_LOAD_STOP) {
323 // Take the opportunity to set some (minimal) additional 324 // Take the opportunity to set some (minimal) additional
324 // script permissions required for the web UI. 325 // script permissions required for the web UI.
325 GURL url = web_ui()->web_contents()->GetURL(); 326 GURL url = web_ui()->web_contents()->GetURL();
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 file_type, 725 file_type,
725 false, 726 false,
726 delete_on_close); 727 delete_on_close);
727 return true; 728 return true;
728 } 729 }
729 } 730 }
730 return false; 731 return false;
731 } 732 }
732 733
733 } // end namespace 734 } // end namespace
OLDNEW
« no previous file with comments | « chrome/browser/prerender/prerender_browsertest.cc ('k') | chrome/browser/printing/print_preview_message_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698