| 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_UI_COCOA_WEB_INTENT_PICKER_COCOA_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_WEB_INTENT_PICKER_COCOA_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_WEB_INTENT_PICKER_COCOA_H_ | 6 #define CHROME_BROWSER_UI_COCOA_WEB_INTENT_PICKER_COCOA_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/string16.h" | 12 #include "base/string16.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "chrome/browser/ui/intents/web_intent_picker.h" | 14 #include "chrome/browser/ui/intents/web_intent_picker.h" |
| 15 #include "chrome/browser/ui/intents/web_intent_picker_model.h" | 15 #include "chrome/browser/ui/intents/web_intent_picker_model.h" |
| 16 #include "chrome/browser/ui/intents/web_intent_picker_model_observer.h" | 16 #include "chrome/browser/ui/intents/web_intent_picker_model_observer.h" |
| 17 | 17 |
| 18 class ConstrainedWindow; | 18 class ConstrainedWindow; |
| 19 class TabContents; | 19 class TabContents; |
| 20 typedef TabContents TabContentsWrapper; | |
| 21 @class WebIntentPickerSheetController; | 20 @class WebIntentPickerSheetController; |
| 22 class WebIntentInlineDispositionDelegate; | 21 class WebIntentInlineDispositionDelegate; |
| 23 | 22 |
| 24 // A bridge class that enables communication between ObjectiveC and C++. | 23 // A bridge class that enables communication between ObjectiveC and C++. |
| 25 class WebIntentPickerCocoa : public WebIntentPicker, | 24 class WebIntentPickerCocoa : public WebIntentPicker, |
| 26 public WebIntentPickerModelObserver { | 25 public WebIntentPickerModelObserver { |
| 27 public: | 26 public: |
| 28 // |wrapper|, and |delegate| must not be NULL. | 27 // |tab_contents| and |delegate| must not be NULL. |
| 29 // |browser| should only be NULL for testing purposes. | 28 // |browser| should only be NULL for testing purposes. |
| 30 WebIntentPickerCocoa(TabContentsWrapper* wrapper, | 29 WebIntentPickerCocoa(TabContents* tab_contents, |
| 31 WebIntentPickerDelegate* delegate, | 30 WebIntentPickerDelegate* delegate, |
| 32 WebIntentPickerModel* model); | 31 WebIntentPickerModel* model); |
| 33 virtual ~WebIntentPickerCocoa(); | 32 virtual ~WebIntentPickerCocoa(); |
| 34 | 33 |
| 35 void OnSheetDidEnd(NSWindow* sheet); | 34 void OnSheetDidEnd(NSWindow* sheet); |
| 36 | 35 |
| 37 WebIntentPickerModel* model() { return model_; } | 36 WebIntentPickerModel* model() { return model_; } |
| 38 | 37 |
| 39 // WebIntentPickerDelegate forwarding API. | 38 // WebIntentPickerDelegate forwarding API. |
| 40 void OnCancelled(); | 39 void OnCancelled(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 61 | 60 |
| 62 private: | 61 private: |
| 63 ConstrainedWindow* window_; // Window for constrained sheet. Weak reference. | 62 ConstrainedWindow* window_; // Window for constrained sheet. Weak reference. |
| 64 | 63 |
| 65 // Weak pointer to the |delegate_| to notify about user choice/cancellation. | 64 // Weak pointer to the |delegate_| to notify about user choice/cancellation. |
| 66 WebIntentPickerDelegate* delegate_; | 65 WebIntentPickerDelegate* delegate_; |
| 67 | 66 |
| 68 // The picker model. Weak reference. | 67 // The picker model. Weak reference. |
| 69 WebIntentPickerModel* model_; | 68 WebIntentPickerModel* model_; |
| 70 | 69 |
| 71 // Wrapper around the WebContents we're in. Weak Reference. | 70 // TabContents we're in. Weak Reference. |
| 72 TabContentsWrapper* wrapper_; | 71 TabContents* tab_contents_; |
| 73 | 72 |
| 74 WebIntentPickerSheetController* sheet_controller_; // Weak reference. | 73 WebIntentPickerSheetController* sheet_controller_; // Weak reference. |
| 75 | 74 |
| 76 // Tab contents wrapper to hold intent page if inline disposition is used. | 75 // TabContents to hold intent page if inline disposition is used. |
| 77 scoped_ptr<TabContentsWrapper> inline_disposition_tab_contents_; | 76 scoped_ptr<TabContents> inline_disposition_tab_contents_; |
| 78 | 77 |
| 79 // Delegate for inline disposition tab contents. | 78 // Delegate for inline disposition tab contents. |
| 80 scoped_ptr<WebIntentInlineDispositionDelegate> inline_disposition_delegate_; | 79 scoped_ptr<WebIntentInlineDispositionDelegate> inline_disposition_delegate_; |
| 81 | 80 |
| 82 // Indicate that we invoked a service, instead of just closing/cancelling. | 81 // Indicate that we invoked a service, instead of just closing/cancelling. |
| 83 bool service_invoked; | 82 bool service_invoked; |
| 84 | 83 |
| 85 // Re-layout the intent picker. | 84 // Re-layout the intent picker. |
| 86 void PerformLayout(); | 85 void PerformLayout(); |
| 87 | 86 |
| 88 // Default constructor, for testing only. | 87 // Default constructor, for testing only. |
| 89 WebIntentPickerCocoa(); | 88 WebIntentPickerCocoa(); |
| 90 | 89 |
| 91 // For testing access. | 90 // For testing access. |
| 92 friend class WebIntentSheetControllerBrowserTest; | 91 friend class WebIntentSheetControllerBrowserTest; |
| 93 | 92 |
| 94 DISALLOW_COPY_AND_ASSIGN(WebIntentPickerCocoa); | 93 DISALLOW_COPY_AND_ASSIGN(WebIntentPickerCocoa); |
| 95 }; | 94 }; |
| 96 | 95 |
| 97 #endif // CHROME_BROWSER_UI_COCOA_WEB_INTENT_PICKER_COCOA_H_ | 96 #endif // CHROME_BROWSER_UI_COCOA_WEB_INTENT_PICKER_COCOA_H_ |
| OLD | NEW |