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/memory/weak_ptr.h" |
12 #include "chrome/browser/ui/intents/web_intent_picker.h" | 13 #include "chrome/browser/ui/intents/web_intent_picker.h" |
13 #include "chrome/browser/ui/intents/web_intent_picker_model.h" | 14 #include "chrome/browser/ui/intents/web_intent_picker_model.h" |
14 #include "chrome/browser/ui/intents/web_intent_picker_model_observer.h" | 15 #include "chrome/browser/ui/intents/web_intent_picker_model_observer.h" |
15 | 16 |
16 class InlineHtmlContentDelegate; | 17 class InlineHtmlContentDelegate; |
17 class TabContentsWrapper; | 18 class TabContentsWrapper; |
18 @class WebIntentBubbleController; | 19 @class WebIntentBubbleController; |
19 | 20 |
20 // A bridge class that enables communication between ObjectiveC and C++. | 21 // A bridge class that enables communication between ObjectiveC and C++. |
21 class WebIntentPickerCocoa : public WebIntentPicker, | 22 class WebIntentPickerCocoa : public WebIntentPicker, |
(...skipping 26 matching lines...) Expand all Loading... |
48 // Weak pointer to the |delegate_| to notify about user choice/cancellation. | 49 // Weak pointer to the |delegate_| to notify about user choice/cancellation. |
49 WebIntentPickerDelegate* delegate_; | 50 WebIntentPickerDelegate* delegate_; |
50 | 51 |
51 // The picker model. Weak reference. | 52 // The picker model. Weak reference. |
52 WebIntentPickerModel* model_; | 53 WebIntentPickerModel* model_; |
53 | 54 |
54 Browser* browser_; // The browser we're in. Weak Reference. | 55 Browser* browser_; // The browser we're in. Weak Reference. |
55 | 56 |
56 WebIntentBubbleController* controller_; // Weak reference. | 57 WebIntentBubbleController* controller_; // Weak reference. |
57 | 58 |
| 59 // Factory for weak ptrs, used for delayed callbacks. |
| 60 base::WeakPtrFactory<WebIntentPickerCocoa> weak_ptr_factory_; |
| 61 |
58 // Tab contents wrapper to hold intent page if inline disposition is used. | 62 // Tab contents wrapper to hold intent page if inline disposition is used. |
59 scoped_ptr<TabContentsWrapper> inline_disposition_tab_contents_; | 63 scoped_ptr<TabContentsWrapper> inline_disposition_tab_contents_; |
60 | 64 |
61 // Delegate for inline disposition tab contents. | 65 // Delegate for inline disposition tab contents. |
62 scoped_ptr<InlineHtmlContentDelegate> inline_disposition_delegate_; | 66 scoped_ptr<InlineHtmlContentDelegate> inline_disposition_delegate_; |
63 | 67 |
| 68 // Post a delayed task to do layout, if it isn't already pending. |
| 69 void PerformDelayedLayout(); |
| 70 |
| 71 // Re-layout the intent picker. |
| 72 void PerformLayout(); |
| 73 |
64 // Default constructor, for testing only. | 74 // Default constructor, for testing only. |
65 WebIntentPickerCocoa(); | 75 WebIntentPickerCocoa(); |
66 | 76 |
67 // For testing access. | 77 // For testing access. |
68 friend class WebIntentBubbleControllerTest; | 78 friend class WebIntentBubbleControllerTest; |
69 | 79 |
70 DISALLOW_COPY_AND_ASSIGN(WebIntentPickerCocoa); | 80 DISALLOW_COPY_AND_ASSIGN(WebIntentPickerCocoa); |
71 }; | 81 }; |
72 | 82 |
73 #endif // CHROME_BROWSER_UI_COCOA_WEB_INTENT_PICKER_COCOA_H_ | 83 #endif // CHROME_BROWSER_UI_COCOA_WEB_INTENT_PICKER_COCOA_H_ |
OLD | NEW |