• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1  // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2  // Use of this source code is governed by a BSD-style license that can be
3  // found in the LICENSE file.
4  
5  #ifndef CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_BUBBLE_HOST_H_
6  #define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_BUBBLE_HOST_H_
7  #pragma once
8  
9  #include <set>
10  
11  #include "base/basictypes.h"
12  
13  class BrowserBubble;
14  
15  // A class providing a hosting environment for BrowserBubble instances.
16  // Allows for notification to attached BrowserBubbles of browser move, and
17  // close events.
18  class BrowserBubbleHost {
19   public:
20    BrowserBubbleHost();
21    ~BrowserBubbleHost();
22  
23    // Invoked when the window containing the attached browser-bubbles is moved.
24    // Calls BrowserBubble::BrowserWindowMoved on all attached bubbles.
25    void WindowMoved();
26  
27    // To be called when the frame containing the BrowserBubbleHost is closing.
28    // Calls BrowserBubble::BrowserWindowClosing on all attached bubbles.
29    void Close();
30  
31    // Registers/Unregisters |bubble| to receive notifications when the host moves
32    // or is closed.
33    void AttachBrowserBubble(BrowserBubble* bubble);
34    void DetachBrowserBubble(BrowserBubble* bubble);
35  
36   private:
37    // The set of bubbles associated with this host.
38    typedef std::set<BrowserBubble*> BubbleSet;
39    BubbleSet browser_bubbles_;
40  
41    DISALLOW_COPY_AND_ASSIGN(BrowserBubbleHost);
42  };
43  
44  #endif  // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_BUBBLE_HOST_H_
45