1 // Copyright 2017 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_BUBBLE_ANCHOR_UTIL_H_
6 #define CHROME_BROWSER_UI_BUBBLE_ANCHOR_UTIL_H_
7 
8 #include "build/build_config.h"
9 #include "ui/gfx/native_widget_types.h"
10 
11 namespace gfx {
12 class Rect;
13 }
14 
15 class Browser;
16 
17 namespace bubble_anchor_util {
18 
19 // Indicates which browser component to use as an anchor.
20 // Used as a parameter of GetPageInfoAnchorView().
21 enum Anchor {
22   kLocationBar,
23   kAppMenuButton,
24   kCustomTabBar,
25 };
26 
27 // Offset from the window edge to show bubbles when there is no location bar.
28 // E.g., when in fullscreen or in a Hosted App window. Don't center, since that
29 // could obscure a fullscreen bubble.
30 constexpr int kNoToolbarLeftOffset = 40;
31 
32 // Returns the Rect appropriate for anchoring a bubble to |browser|'s Page Info
33 // icon, or an appropriate fallback when that is not visible. This is used only
34 // when the platform-specific GetPageInfoAnchorView() is unable to return an
35 // actual View. This function has separate implementations for Views- and Cocoa-
36 // based browsers. The anchor rect is in screen coordinates.
37 gfx::Rect GetPageInfoAnchorRect(Browser* browser);
38 
39 }  // namespace bubble_anchor_util
40 
41 #endif  // CHROME_BROWSER_UI_BUBBLE_ANCHOR_UTIL_H_
42