Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_VIEWS_FIRST_RUN_BUBBLE_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_FIRST_RUN_BUBBLE_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_FIRST_RUN_BUBBLE_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_FIRST_RUN_BUBBLE_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/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "chrome/browser/first_run/first_run.h" | 12 #include "chrome/browser/first_run/first_run.h" |
| 13 #include "chrome/browser/ui/views/bubble/bubble.h" | 13 #include "views/bubble/bubble_delegate.h" |
| 14 | |
| 15 namespace views { | |
| 16 class View; | |
| 17 class Widget; | |
| 18 } | |
| 14 | 19 |
| 15 class FirstRunBubbleViewBase; | 20 class FirstRunBubbleViewBase; |
| 16 class Profile; | 21 class Profile; |
| 17 | 22 |
| 18 class FirstRunBubble : public Bubble, | 23 class FirstRunBubble : public views::BubbleDelegateView { |
| 19 public BubbleDelegate { | |
| 20 public: | 24 public: |
| 21 static FirstRunBubble* Show(Profile* profile, | 25 static views::Widget* Show(Profile* profile, |
| 22 views::Widget* parent, | 26 views::Widget* parent, |
| 23 const gfx::Rect& position_relative_to, | 27 const gfx::Rect& position_relative_to, |
| 24 views::BubbleBorder::ArrowLocation arrow_location, | 28 views::BubbleBorder::ArrowLocation arrow_location, |
| 25 FirstRun::BubbleType bubble_type); | 29 FirstRun::BubbleType bubble_type); |
| 26 | 30 |
| 27 private: | 31 private: |
| 28 FirstRunBubble(); | 32 FirstRunBubble(Profile* profile, |
| 33 views::Widget* parent, | |
| 34 const gfx::Rect& position_relative_to, | |
| 35 views::BubbleBorder::ArrowLocation arrow_location, | |
| 36 FirstRun::BubbleType bubble_type); | |
| 29 virtual ~FirstRunBubble(); | 37 virtual ~FirstRunBubble(); |
| 30 | 38 |
| 31 void set_view(FirstRunBubbleViewBase* view) { view_ = view; } | 39 // BubbleDelegateView override: |
| 40 virtual void Init(); | |
|
msw
2011/10/18 18:39:23
Please try to match the order and visibility (Init
alicet1
2011/10/19 05:02:15
Done.
| |
| 41 virtual gfx::Point GetAnchorPoint() const OVERRIDE; | |
| 42 // View override: | |
|
msw
2011/10/18 18:39:23
Add a blank line before new "* overrides:" blocks.
alicet1
2011/10/19 05:02:15
Done.
| |
| 43 virtual gfx::Size GetPreferredSize() OVERRIDE; | |
| 44 // WidgetDelegate override: | |
| 45 virtual views::View* GetInitiallyFocusedView() OVERRIDE; | |
| 32 | 46 |
| 47 #if !defined(USE_AURA) | |
| 33 // Re-enable the parent window. | 48 // Re-enable the parent window. |
| 34 void EnableParent(); | 49 void EnableParent(); |
| 50 #endif | |
| 35 | 51 |
| 36 #if defined(OS_WIN) && !defined(USE_AURA) | 52 #if defined(OS_WIN) && !defined(USE_AURA) |
| 37 // Overridden from Bubble: | 53 // Overridden from Bubble: |
| 38 virtual void OnActivate(UINT action, BOOL minimized, HWND window) OVERRIDE; | 54 virtual void OnActivate(UINT action, BOOL minimized, HWND window) OVERRIDE; |
| 39 #endif | 55 #endif |
| 40 | 56 |
| 41 // BubbleDelegate. | 57 #if !defined(USE_AURA) |
| 42 virtual void BubbleClosing(Bubble* bubble, bool closed_by_escape) OVERRIDE; | 58 virtual void BubbleClosing(Bubble* bubble, bool closed_by_escape) OVERRIDE; |
|
msw
2011/10/18 18:39:23
What is the Bubble type here?
We should be careful
alicet1
2011/10/19 05:02:15
you mean, when the bubble close, do we care how it
| |
| 43 virtual bool CloseOnEscape() OVERRIDE { return true; } | 59 #endif |
| 44 virtual bool FadeInOnShow() OVERRIDE { return true; } | 60 |
| 61 Profile* profile_; | |
| 62 views::Widget* parent_; | |
| 63 const gfx::Rect position_relative_to_; | |
|
msw
2011/10/18 18:39:23
I thought you liked 'anchor' :)
alicet1
2011/10/19 05:02:15
I do, but the caller (location_bar) called it posi
| |
| 64 views::BubbleBorder::ArrowLocation arrow_location_; | |
| 65 FirstRun::BubbleType bubble_type_; | |
| 66 gfx::Size preferred_size_; | |
| 67 // pointer into content view for initially focused view. Not owned. | |
|
msw
2011/10/18 18:39:23
Capitalize 'p'; perhaps BubbleDelegateView should
alicet1
2011/10/19 05:02:15
Done.
| |
| 68 views::View* initially_focused_view_; | |
| 45 | 69 |
| 46 // Whether we have already been activated. | 70 // Whether we have already been activated. |
| 47 bool has_been_activated_; | 71 bool has_been_activated_; |
| 48 | 72 |
| 49 base::WeakPtrFactory<FirstRunBubble> enable_window_method_factory_; | 73 base::WeakPtrFactory<FirstRunBubble> enable_window_method_factory_; |
| 50 | 74 |
| 51 // The view inside the FirstRunBubble. | |
| 52 FirstRunBubbleViewBase* view_; | |
| 53 | |
| 54 DISALLOW_COPY_AND_ASSIGN(FirstRunBubble); | 75 DISALLOW_COPY_AND_ASSIGN(FirstRunBubble); |
| 55 }; | 76 }; |
| 56 | 77 |
| 57 #endif // CHROME_BROWSER_UI_VIEWS_FIRST_RUN_BUBBLE_H_ | 78 #endif // CHROME_BROWSER_UI_VIEWS_FIRST_RUN_BUBBLE_H_ |
| OLD | NEW |