Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

Side by Side Diff: chrome/browser/chromeos/compact_location_bar.h

Issue 341008: CompactLocationBar (Closed)
Patch Set: comment updated Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2009 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_CHROMEOS_COMPACT_LOCATION_BAR_H_
6 #define CHROME_BROWSER_CHROMEOS_COMPACT_LOCATION_BAR_H_
7
8 #include "base/basictypes.h"
9 #include "base/timer.h"
10 #include "chrome/browser/bubble_positioner.h"
11 #include "chrome/browser/autocomplete/autocomplete_edit.h"
12 #include "views/controls/button/button.h"
13 #include "views/view.h"
14
15 class AutocompleteEditViewGtk;
16 class Browser;
17 class BrowserView;
18 class ToolbarStarToggleGtk;
19 class Tab;
20 class TabContents;
21 class TabStrip;
22
23 namespace views {
24 class ImageButton;
25 class NativeViewHost;
26 } // namespace views
27
28 // CompactLocationBar is a version of location bar that is shown under
29 // a tab for short priod of used when Chrome is in the compact
30 // navigation bar mode.
31 // TODO(oshima): re-implement w/o using a popup, like a FindBar.
32 class CompactLocationBar : public views::View,
33 public views::ButtonListener,
34 public AutocompleteEditController,
35 public BubblePositioner {
36 public:
37 explicit CompactLocationBar(BrowserView* browser_view);
38 ~CompactLocationBar();
39
40 // Returns the bounds to locale the compact location bar under the tab.
41 gfx::Rect GetBoundsUnderTab(const Tab* tab) const;
42
43 // (Re)Starts the popup timer that hides the popup after X seconds.
44 void StartPopupTimer();
45
46 // Updates the content and the location of the compact location bar.
47 void Update(const Tab* tab, const TabContents* contents);
48
49 // Updates the location of the location bar popup under the given tab.
50 void UpdateBounds(const Tab* tab);
51
52 private:
53 Browser* browser() const;
54
55 // Cancels the popup timer.
56 void CancelPopupTimer();
57
58 // Hides the popup window.
59 void HidePopup();
60
61 // Called when the view is added to the tree to initialize the
62 // CompactLocationBar.
63 void Init();
64
65 // Overridden from views::View.
66 virtual gfx::Size GetPreferredSize();
67 virtual void Layout();
68 virtual void Paint(gfx::Canvas* canvas);
69 virtual void ViewHierarchyChanged(bool is_add, views::View* parent,
70 views::View* child);
71 virtual void OnMouseEntered(const views::MouseEvent& event);
72 virtual void OnMouseExited(const views::MouseEvent& event);
73
74 // Overridden from views::ButtonListener:
75 virtual void ButtonPressed(views::Button* sender, const views::Event& event);
76
77 // AutocompleteEditController implementation.
78 virtual void OnAutocompleteAccept(const GURL& url,
79 WindowOpenDisposition disposition,
80 PageTransition::Type transition,
81 const GURL& alternate_nav_url);
82 virtual void OnChanged();
83 virtual void OnKillFocus() {}
84 virtual void OnSetFocus() {}
85 virtual void OnInputInProgress(bool in_progress);
86 virtual SkBitmap GetFavIcon() const;
87 virtual std::wstring GetTitle() const;
88
89 // BubblePositioner implementation.
90 virtual gfx::Rect GetLocationStackBounds() const;
91
92 BrowserView* browser_view_;
93 const TabContents* current_contents_;
94
95 views::ImageButton* reload_;
96 scoped_ptr<AutocompleteEditViewGtk> location_entry_;
97 views::NativeViewHost* location_entry_view_;
98
99 // scoped_ptr<ToolbarStarToggleGtk> star_;
100 views::NativeViewHost* star_view_;
101
102 scoped_ptr<base::OneShotTimer<CompactLocationBar> > popup_timer_;
103
104 // A popup window to show the compact location bar.
105 views::Widget* popup_;
106
107 DISALLOW_COPY_AND_ASSIGN(CompactLocationBar);
108 };
109
110 #endif // CHROME_BROWSER_CHROMEOS_COMPACT_LOCATION_BAR_H_
111
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/chromeos_browser_extenders.cc ('k') | chrome/browser/chromeos/compact_location_bar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698