summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/first_run_bubble.h
blob: d921987d4c25c1d51c2cdea7ed2f17a99c9dee95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_VIEWS_FIRST_RUN_BUBBLE_H_
#define CHROME_BROWSER_VIEWS_FIRST_RUN_BUBBLE_H_

#include "base/task.h"
#include "chrome/browser/views/info_bubble.h"

class FirstRunBubbleView;
class Profile;

class FirstRunBubble : public InfoBubble,
                       public InfoBubbleDelegate {
 public:
  static FirstRunBubble* Show(Profile* profile, HWND parent_hwnd,
                              const gfx::Rect& position_relative_to);

  FirstRunBubble()
      : enable_window_method_factory_(this),
        has_been_activated_(false),
        view_(NULL) {
  }

  virtual ~FirstRunBubble() {
    // We should have called RevokeAll on the method factory already.
    DCHECK(enable_window_method_factory_.empty());
    enable_window_method_factory_.RevokeAll();
  }

  void set_view(FirstRunBubbleView* view) { view_ = view; }

  // Overridden from InfoBubble:
  virtual void OnActivate(UINT action, BOOL minimized, HWND window);

  // InfoBubbleDelegate.
  virtual void InfoBubbleClosing(InfoBubble* info_bubble,
                                 bool closed_by_escape);
  virtual bool CloseOnEscape() { return true; }

 private:
  // Re-enable the parent window.
  void EnableParent();

  // Whether we have already been activated.
  bool has_been_activated_;

  ScopedRunnableMethodFactory<FirstRunBubble> enable_window_method_factory_;

  // The view inside the FirstRunBubble.
  FirstRunBubbleView* view_;

  DISALLOW_COPY_AND_ASSIGN(FirstRunBubble);
};

#endif  // CHROME_BROWSER_VIEWS_FIRST_RUN_BUBBLE_H_