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

Side by Side Diff: trunk/src/chrome/browser/ui/webui/print_preview/print_preview_handler.h

Issue 13898008: Revert 194782 "Native api to get OAuth2 access tokens in Print P..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 8 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ 6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 void HandleShowSystemDialog(const base::ListValue* args); 108 void HandleShowSystemDialog(const base::ListValue* args);
109 109
110 // Callback for the signin dialog to call once signin is complete. 110 // Callback for the signin dialog to call once signin is complete.
111 static void OnSigninComplete( 111 static void OnSigninComplete(
112 const base::WeakPtr<PrintPreviewHandler>& handler); 112 const base::WeakPtr<PrintPreviewHandler>& handler);
113 113
114 // Brings up a dialog to allow the user to sign into cloud print. 114 // Brings up a dialog to allow the user to sign into cloud print.
115 // |args| is unused. 115 // |args| is unused.
116 void HandleSignin(const base::ListValue* args); 116 void HandleSignin(const base::ListValue* args);
117 117
118 // Generates new token and sends back to UI.
119 void HandleGetAccessToken(const base::ListValue* args);
120
121 // Brings up a web page to allow the user to configure cloud print. 118 // Brings up a web page to allow the user to configure cloud print.
122 // |args| is unused. 119 // |args| is unused.
123 void HandleManageCloudPrint(const base::ListValue* args); 120 void HandleManageCloudPrint(const base::ListValue* args);
124 121
125 // Gathers UMA stats when the print preview dialog is about to close. 122 // Gathers UMA stats when the print preview dialog is about to close.
126 // |args| is unused. 123 // |args| is unused.
127 void HandleClosePreviewDialog(const base::ListValue* args); 124 void HandleClosePreviewDialog(const base::ListValue* args);
128 125
129 // Asks the browser to show the native printer management dialog. 126 // Asks the browser to show the native printer management dialog.
130 // |args| is unused. 127 // |args| is unused.
(...skipping 16 matching lines...) Expand all
147 // NOTE: This is needed to open FedEx confirmation window as a new tab. 144 // NOTE: This is needed to open FedEx confirmation window as a new tab.
148 // Javascript's "window.open" opens a new window popup (since initiated from 145 // Javascript's "window.open" opens a new window popup (since initiated from
149 // async HTTP request) and worse yet, on Windows and Chrome OS, the opened 146 // async HTTP request) and worse yet, on Windows and Chrome OS, the opened
150 // window opens behind the initiator window. 147 // window opens behind the initiator window.
151 void HandleForceOpenNewTab(const base::ListValue* args); 148 void HandleForceOpenNewTab(const base::ListValue* args);
152 149
153 void SendInitialSettings( 150 void SendInitialSettings(
154 const std::string& default_printer, 151 const std::string& default_printer,
155 const std::string& cloud_print_data); 152 const std::string& cloud_print_data);
156 153
157 // Send OAuth2 access token.
158 void SendAccessToken(const std::string& type,
159 const std::string& access_token);
160
161 // Sends the printer capabilities to the Web UI. |settings_info| contains 154 // Sends the printer capabilities to the Web UI. |settings_info| contains
162 // printer capabilities information. 155 // printer capabilities information.
163 void SendPrinterCapabilities(const base::DictionaryValue& settings_info); 156 void SendPrinterCapabilities(const base::DictionaryValue& settings_info);
164 157
165 // Sends error notification to the Web UI when unable to return the printer 158 // Sends error notification to the Web UI when unable to return the printer
166 // capabilities. 159 // capabilities.
167 void SendFailedToGetPrinterCapabilities(const std::string& printer_name); 160 void SendFailedToGetPrinterCapabilities(const std::string& printer_name);
168 161
169 // Send the list of printers to the Web UI. 162 // Send the list of printers to the Web UI.
170 void SetupPrinterList(const base::ListValue& printers); 163 void SetupPrinterList(const base::ListValue& printers);
(...skipping 27 matching lines...) Expand all
198 void PostPrintToPdfTask(); 191 void PostPrintToPdfTask();
199 192
200 // Populates |settings| according to the current locale. 193 // Populates |settings| according to the current locale.
201 void GetNumberFormatAndMeasurementSystem(base::DictionaryValue* settings); 194 void GetNumberFormatAndMeasurementSystem(base::DictionaryValue* settings);
202 195
203 static printing::StickySettings* GetStickySettings(); 196 static printing::StickySettings* GetStickySettings();
204 197
205 bool GetPreviewDataAndTitle(scoped_refptr<base::RefCountedBytes>* data, 198 bool GetPreviewDataAndTitle(scoped_refptr<base::RefCountedBytes>* data,
206 string16* title) const; 199 string16* title) const;
207 200
208 void InitTokenService();
209
210 // Pointer to current print system. 201 // Pointer to current print system.
211 scoped_refptr<printing::PrintBackend> print_backend_; 202 scoped_refptr<printing::PrintBackend> print_backend_;
212 203
213 // The underlying dialog object. 204 // The underlying dialog object.
214 scoped_refptr<ui::SelectFileDialog> select_file_dialog_; 205 scoped_refptr<ui::SelectFileDialog> select_file_dialog_;
215 206
216 // A count of how many requests received to regenerate preview data. 207 // A count of how many requests received to regenerate preview data.
217 // Initialized to 0 then incremented and emitted to a histogram. 208 // Initialized to 0 then incremented and emitted to a histogram.
218 int regenerate_preview_request_count_; 209 int regenerate_preview_request_count_;
219 210
220 // A count of how many requests received to show manage printers dialog. 211 // A count of how many requests received to show manage printers dialog.
221 int manage_printers_dialog_request_count_; 212 int manage_printers_dialog_request_count_;
222 int manage_cloud_printers_dialog_request_count_; 213 int manage_cloud_printers_dialog_request_count_;
223 214
224 // Whether we have already logged a failed print preview. 215 // Whether we have already logged a failed print preview.
225 bool reported_failed_preview_; 216 bool reported_failed_preview_;
226 217
227 // Whether we have already logged the number of printers this session. 218 // Whether we have already logged the number of printers this session.
228 bool has_logged_printers_count_; 219 bool has_logged_printers_count_;
229 220
230 // Holds the path to the print to pdf request. It is empty if no such request 221 // Holds the path to the print to pdf request. It is empty if no such request
231 // exists. 222 // exists.
232 scoped_ptr<base::FilePath> print_to_pdf_path_; 223 scoped_ptr<base::FilePath> print_to_pdf_path_;
233 224
234 // Holds token service to get OAuth2 access tokens.
235 class AccessTokenService;
236 scoped_ptr<AccessTokenService> token_service_;
237
238 DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler); 225 DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler);
239 }; 226 };
240 227
241 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ 228 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698