| OLD | NEW | 
|    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_PRINTING_PRINT_VIEW_MANAGER_H_ |    5 #ifndef CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_H_ | 
|    6 #define CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_H_ |    6 #define CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_H_ | 
|    7  |    7  | 
|    8 #include "base/memory/ref_counted.h" |    8 #include "base/memory/ref_counted.h" | 
|    9 #include "base/prefs/public/pref_observer.h" |  | 
|   10 #include "base/string16.h" |    9 #include "base/string16.h" | 
|   11 #include "chrome/browser/api/prefs/pref_member.h" |   10 #include "chrome/browser/api/prefs/pref_member.h" | 
|   12 #include "content/public/browser/notification_observer.h" |   11 #include "content/public/browser/notification_observer.h" | 
|   13 #include "content/public/browser/notification_registrar.h" |   12 #include "content/public/browser/notification_registrar.h" | 
|   14 #include "content/public/browser/web_contents_observer.h" |   13 #include "content/public/browser/web_contents_observer.h" | 
|   15 #include "content/public/browser/web_contents_user_data.h" |   14 #include "content/public/browser/web_contents_user_data.h" | 
|   16 #include "printing/printed_pages_source.h" |   15 #include "printing/printed_pages_source.h" | 
|   17  |   16  | 
|   18 struct PrintHostMsg_DidPrintPage_Params; |   17 struct PrintHostMsg_DidPrintPage_Params; | 
|   19  |   18  | 
|   20 namespace content { |   19 namespace content { | 
|   21 class RenderProcessHost; |   20 class RenderProcessHost; | 
|   22 class RenderViewHost; |   21 class RenderViewHost; | 
|   23 } |   22 } | 
|   24  |   23  | 
|   25 namespace printing { |   24 namespace printing { | 
|   26  |   25  | 
|   27 class JobEventDetails; |   26 class JobEventDetails; | 
|   28 class PrintJob; |   27 class PrintJob; | 
|   29 class PrintJobWorkerOwner; |   28 class PrintJobWorkerOwner; | 
|   30 class PrintViewManagerObserver; |   29 class PrintViewManagerObserver; | 
|   31  |   30  | 
|   32 // Manages the print commands for a WebContents. |   31 // Manages the print commands for a WebContents. | 
|   33 class PrintViewManager : public content::NotificationObserver, |   32 class PrintViewManager : public content::NotificationObserver, | 
|   34                          public PrefObserver, |  | 
|   35                          public PrintedPagesSource, |   33                          public PrintedPagesSource, | 
|   36                          public content::WebContentsObserver, |   34                          public content::WebContentsObserver, | 
|   37                          public content::WebContentsUserData<PrintViewManager> { |   35                          public content::WebContentsUserData<PrintViewManager> { | 
|   38  public: |   36  public: | 
|   39   virtual ~PrintViewManager(); |   37   virtual ~PrintViewManager(); | 
|   40  |   38  | 
|   41   // Prints the current document immediately. Since the rendering is |   39   // Prints the current document immediately. Since the rendering is | 
|   42   // asynchronous, the actual printing will not be completed on the return of |   40   // asynchronous, the actual printing will not be completed on the return of | 
|   43   // this function. Returns false if printing is impossible at the moment. |   41   // this function. Returns false if printing is impossible at the moment. | 
|   44   bool PrintNow(); |   42   bool PrintNow(); | 
| (...skipping 27 matching lines...) Expand all  Loading... | 
|   72   void PrintPreviewDone(); |   70   void PrintPreviewDone(); | 
|   73  |   71  | 
|   74   // Whether to block scripted printing for our tab or not. |   72   // Whether to block scripted printing for our tab or not. | 
|   75   void UpdateScriptedPrintingBlocked(); |   73   void UpdateScriptedPrintingBlocked(); | 
|   76  |   74  | 
|   77   // Sets |observer| as the current PrintViewManagerObserver. Pass in NULL to |   75   // Sets |observer| as the current PrintViewManagerObserver. Pass in NULL to | 
|   78   // remove the current observer. |observer| may always be NULL, but |observer_| |   76   // remove the current observer. |observer| may always be NULL, but |observer_| | 
|   79   // must be NULL if |observer| is non-NULL. |   77   // must be NULL if |observer| is non-NULL. | 
|   80   void set_observer(PrintViewManagerObserver* observer); |   78   void set_observer(PrintViewManagerObserver* observer); | 
|   81  |   79  | 
|   82   // PrefObserver implementation. |  | 
|   83   virtual void OnPreferenceChanged(PrefServiceBase* service, |  | 
|   84                                    const std::string& pref_name) OVERRIDE; |  | 
|   85  |  | 
|   86   // PrintedPagesSource implementation. |   80   // PrintedPagesSource implementation. | 
|   87   virtual string16 RenderSourceName() OVERRIDE; |   81   virtual string16 RenderSourceName() OVERRIDE; | 
|   88  |   82  | 
|   89   // content::NotificationObserver implementation. |   83   // content::NotificationObserver implementation. | 
|   90   virtual void Observe(int type, |   84   virtual void Observe(int type, | 
|   91                        const content::NotificationSource& source, |   85                        const content::NotificationSource& source, | 
|   92                        const content::NotificationDetails& details) OVERRIDE; |   86                        const content::NotificationDetails& details) OVERRIDE; | 
|   93  |   87  | 
|   94   // content::WebContentsObserver implementation. |   88   // content::WebContentsObserver implementation. | 
|   95   virtual void DidStartLoading( |   89   virtual void DidStartLoading( | 
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  218  |  212  | 
|  219   // Whether our content is in blocked state. |  213   // Whether our content is in blocked state. | 
|  220   bool tab_content_blocked_; |  214   bool tab_content_blocked_; | 
|  221  |  215  | 
|  222   DISALLOW_COPY_AND_ASSIGN(PrintViewManager); |  216   DISALLOW_COPY_AND_ASSIGN(PrintViewManager); | 
|  223 }; |  217 }; | 
|  224  |  218  | 
|  225 }  // namespace printing |  219 }  // namespace printing | 
|  226  |  220  | 
|  227 #endif  // CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_H_ |  221 #endif  // CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_H_ | 
| OLD | NEW |