1c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Copyright (c) 2010 The Chromium Authors. All rights reserved.
2c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Use of this source code is governed by a BSD-style license that can be
3c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// found in the LICENSE file.
4c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch
5c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch#ifndef CHROME_BROWSER_STATUS_BUBBLE_H_
6c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch#define CHROME_BROWSER_STATUS_BUBBLE_H_
73345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick#pragma once
8c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch
93345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick#include "base/string16.h"
10c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch
11c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass GURL;
12c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochnamespace gfx {
13c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass Point;
14c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch}
15c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch
16c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch////////////////////////////////////////////////////////////////////////////////
17c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// StatusBubble interface
18c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch//  An interface implemented by an object providing the status display area of
19c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch//  the browser window.
20c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch//
21c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochclass StatusBubble {
22c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch public:
23c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch  // On hover, expand status bubble to fit long URL after this delay.
24c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch  static const int kExpandHoverDelay = 1600;
25c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch
26c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch  virtual ~StatusBubble() {}
27c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch
28c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch  // Sets the bubble contents to a specific string and causes the bubble
29c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch  // to display immediately. Subsequent empty SetURL calls (typically called
30c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch  // when the cursor exits a link) will set the status bubble back to its
31c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch  // status text. To hide the status bubble again, either call SetStatus
32c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch  // with an empty string, or call Hide().
333345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick  virtual void SetStatus(const string16& status) = 0;
34c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch
35c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch  // Sets the bubble text to a URL - if given a non-empty URL, this will cause
36c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch  // the bubble to fade in and remain open until given an empty URL or until
37c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch  // the Hide() method is called. languages is the value of Accept-Language
38c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch  // to determine what characters are understood by a user.
39dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen  // TODO(tc): |languages| should be std::string (ascii)-- it's current
40dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen  // usage is as bad as a WideToUTF8Hack.
413345a6884c488ff3a535c2c9acdd33d74b37e311Iain Merrick  virtual void SetURL(const GURL& url, const string16& languages) = 0;
42c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch
43c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch  // Skip the fade and instant-hide the bubble.
44c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch  virtual void Hide() = 0;
45c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch
46c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch  // Called when the user's mouse has moved over web content. This is used to
47c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch  // determine when the status area should move out of the way of the user's
48c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch  // mouse. This may be windows specific pain due to the way messages are
49c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch  // processed for child HWNDs.  |position| is the absolute position of the
50c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch  // pointer, and |left_content| is true if the mouse just left the content
51c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch  // area.
52c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch  virtual void MouseMoved(const gfx::Point& position, bool left_content) = 0;
53c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch
54c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch  // Called when the download shelf becomes visible or invisible.
55c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch  // This is used by to ensure that the status bubble does not obscure
56c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch  // the download shelf, when it is visible.
57c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch  virtual void UpdateDownloadShelfVisibility(bool visible) = 0;
58c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch};
59c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch
60c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch#endif  // CHROME_BROWSER_STATUS_BUBBLE_H_
61