| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_VIEWS_FIRST_RUN_BUBBLE_H__ | 5 #ifndef CHROME_BROWSER_VIEWS_FIRST_RUN_BUBBLE_H_ |
| 6 #define CHROME_BROWSER_VIEWS_FIRST_RUN_BUBBLE_H__ | 6 #define CHROME_BROWSER_VIEWS_FIRST_RUN_BUBBLE_H_ |
| 7 | 7 |
| 8 #include "base/task.h" | 8 #include "base/task.h" |
| 9 #include "chrome/browser/views/info_bubble.h" | 9 #include "chrome/browser/views/info_bubble.h" |
| 10 | 10 |
| 11 class FirstRunBubbleView; |
| 11 class Profile; | 12 class Profile; |
| 12 | 13 |
| 13 class FirstRunBubble : public InfoBubble, | 14 class FirstRunBubble : public InfoBubble, |
| 14 public InfoBubbleDelegate { | 15 public InfoBubbleDelegate { |
| 15 public: | 16 public: |
| 16 static FirstRunBubble* Show(Profile* profile, HWND parent_hwnd, | 17 static FirstRunBubble* Show(Profile* profile, HWND parent_hwnd, |
| 17 const gfx::Rect& position_relative_to); | 18 const gfx::Rect& position_relative_to); |
| 18 | 19 |
| 19 FirstRunBubble() | 20 FirstRunBubble() |
| 20 : enable_window_method_factory_(this), | 21 : enable_window_method_factory_(this), |
| 21 has_been_activated_(false) { | 22 has_been_activated_(false), |
| 23 view_(NULL) { |
| 22 } | 24 } |
| 23 | 25 |
| 24 virtual ~FirstRunBubble() { | 26 virtual ~FirstRunBubble() { |
| 25 // We should have called RevokeAll on the method factory already. | 27 // We should have called RevokeAll on the method factory already. |
| 26 DCHECK(enable_window_method_factory_.empty()); | 28 DCHECK(enable_window_method_factory_.empty()); |
| 27 enable_window_method_factory_.RevokeAll(); | 29 enable_window_method_factory_.RevokeAll(); |
| 28 } | 30 } |
| 29 | 31 |
| 32 void set_view(FirstRunBubbleView* view) { view_ = view; } |
| 33 |
| 30 // Overridden from InfoBubble: | 34 // Overridden from InfoBubble: |
| 31 virtual void OnActivate(UINT action, BOOL minimized, HWND window); | 35 virtual void OnActivate(UINT action, BOOL minimized, HWND window); |
| 32 | 36 |
| 33 // InfoBubbleDelegate. | 37 // InfoBubbleDelegate. |
| 34 virtual void InfoBubbleClosing(InfoBubble* info_bubble, | 38 virtual void InfoBubbleClosing(InfoBubble* info_bubble, |
| 35 bool closed_by_escape); | 39 bool closed_by_escape); |
| 36 virtual bool CloseOnEscape() { return true; } | 40 virtual bool CloseOnEscape() { return true; } |
| 37 | 41 |
| 38 private: | 42 private: |
| 39 // Re-enable the parent window. | 43 // Re-enable the parent window. |
| 40 void EnableParent(); | 44 void EnableParent(); |
| 41 | 45 |
| 42 // Whether we have already been activated. | 46 // Whether we have already been activated. |
| 43 bool has_been_activated_; | 47 bool has_been_activated_; |
| 44 | 48 |
| 45 ScopedRunnableMethodFactory<FirstRunBubble> enable_window_method_factory_; | 49 ScopedRunnableMethodFactory<FirstRunBubble> enable_window_method_factory_; |
| 46 | 50 |
| 47 DISALLOW_EVIL_CONSTRUCTORS(FirstRunBubble); | 51 // The view inside the FirstRunBubble. |
| 52 FirstRunBubbleView* view_; |
| 53 |
| 54 DISALLOW_COPY_AND_ASSIGN(FirstRunBubble); |
| 48 }; | 55 }; |
| 49 | 56 |
| 50 #endif // CHROME_BROWSER_VIEWS_FIRST_RUN_BUBBLE_H__ | 57 #endif // CHROME_BROWSER_VIEWS_FIRST_RUN_BUBBLE_H_ |
| OLD | NEW |