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

Side by Side Diff: chrome/browser/views/autocomplete/autocomplete_popup_gtk.cc

Issue 274046: Linux: Stack autocomplete popup window directly on top of the browser's tople... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 months 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/views/autocomplete/autocomplete_popup_gtk.h ('k') | chrome/common/gtk_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
2 // source code is governed by a BSD-style license that can be found in the 2 // source code is governed by a BSD-style license that can be found in the
3 // LICENSE file. 3 // LICENSE file.
4 4
5 #include "chrome/browser/views/autocomplete/autocomplete_popup_gtk.h" 5 #include "chrome/browser/views/autocomplete/autocomplete_popup_gtk.h"
6 6
7 #include "app/gfx/insets.h" 7 #include "app/gfx/insets.h"
8 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" 8 #include "chrome/browser/autocomplete/autocomplete_edit_view.h"
9 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" 9 #include "chrome/browser/autocomplete/autocomplete_popup_model.h"
10 #include "chrome/browser/views/autocomplete/autocomplete_popup_contents_view.h" 10 #include "chrome/browser/views/autocomplete/autocomplete_popup_contents_view.h"
11 #include "chrome/common/gtk_util.h"
11 12
12 //////////////////////////////////////////////////////////////////////////////// 13 ////////////////////////////////////////////////////////////////////////////////
13 // AutocompletePopupGtk, public: 14 // AutocompletePopupGtk, public:
14 15
15 AutocompletePopupGtk::AutocompletePopupGtk( 16 AutocompletePopupGtk::AutocompletePopupGtk(
16 AutocompletePopupContentsView* contents) 17 AutocompletePopupContentsView* contents)
17 : WidgetGtk(WidgetGtk::TYPE_POPUP), 18 : WidgetGtk(WidgetGtk::TYPE_POPUP),
18 contents_(contents) { 19 contents_(contents),
20 edit_view_(NULL) {
19 set_delete_on_destroy(false); 21 set_delete_on_destroy(false);
20 } 22 }
21 23
22 AutocompletePopupGtk::~AutocompletePopupGtk() { 24 AutocompletePopupGtk::~AutocompletePopupGtk() {
23 } 25 }
24 26
25 void AutocompletePopupGtk::Init(AutocompleteEditView* edit_view, 27 void AutocompletePopupGtk::Init(AutocompleteEditView* edit_view,
26 views::View* contents) { 28 views::View* contents) {
27 MakeTransparent(); 29 MakeTransparent();
28 // Create the popup 30 // Create the popup
29 WidgetGtk::Init(gtk_widget_get_parent(edit_view->GetNativeView()), 31 WidgetGtk::Init(gtk_widget_get_parent(edit_view->GetNativeView()),
30 contents_->GetPopupBounds()); 32 contents_->GetPopupBounds());
31 // The contents is owned by the LocationBarView. 33 // The contents is owned by the LocationBarView.
32 contents_->SetParentOwned(false); 34 contents_->SetParentOwned(false);
33 SetContentsView(contents_); 35 SetContentsView(contents_);
36
37 edit_view_ = edit_view;
34 } 38 }
35 39
36 void AutocompletePopupGtk::Show() { 40 void AutocompletePopupGtk::Show() {
37 // Move the popup to the place appropriate for the window's current position - 41 // Move the popup to the place appropriate for the window's current position -
38 // it may have been moved since it was last shown. 42 // it may have been moved since it was last shown.
39 SetBounds(contents_->GetPopupBounds()); 43 SetBounds(contents_->GetPopupBounds());
40 if (!IsVisible()) 44 if (!IsVisible()) {
41 WidgetGtk::Show(); 45 WidgetGtk::Show();
46 StackWindow();
47 }
42 } 48 }
43 49
44 bool AutocompletePopupGtk::IsOpen() const { 50 bool AutocompletePopupGtk::IsOpen() const {
45 return IsCreated() && IsVisible(); 51 return IsCreated() && IsVisible();
46 } 52 }
47 53
48 bool AutocompletePopupGtk::IsCreated() const { 54 bool AutocompletePopupGtk::IsCreated() const {
49 return GTK_IS_WIDGET(GetNativeView()); 55 return GTK_IS_WIDGET(GetNativeView());
50 } 56 }
57
58 void AutocompletePopupGtk::StackWindow() {
59 GtkWidget* toplevel = gtk_widget_get_toplevel(edit_view_->GetNativeView());
60 DCHECK(GTK_WIDGET_TOPLEVEL(toplevel));
61 gtk_util::StackPopupWindow(GetNativeView(), toplevel);
62 }
OLDNEW
« no previous file with comments | « chrome/browser/views/autocomplete/autocomplete_popup_gtk.h ('k') | chrome/common/gtk_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698