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

Side by Side Diff: chrome/browser/ui/gtk/autofill/autofill_external_delegate_gtk.cc

Issue 10831313: Removing web_contents from AutofillExternalDelegateGtk (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 4 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
« no previous file with comments | « chrome/browser/ui/gtk/autofill/autofill_external_delegate_gtk.h ('k') | no next file » | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/gtk/autofill/autofill_external_delegate_gtk.h" 5 #include "chrome/browser/ui/gtk/autofill/autofill_external_delegate_gtk.h"
6 6
7 #include "chrome/browser/ui/gtk/autofill/autofill_popup_view_gtk.h" 7 #include "chrome/browser/ui/gtk/autofill/autofill_popup_view_gtk.h"
8 #include "chrome/browser/ui/gtk/gtk_theme_service.h" 8 #include "chrome/browser/ui/gtk/gtk_theme_service.h"
9 #include "chrome/browser/ui/tab_contents/tab_contents.h" 9 #include "chrome/browser/ui/tab_contents/tab_contents.h"
10 #include "content/public/browser/web_contents.h" 10 #include "content/public/browser/web_contents.h"
11 #include "content/public/browser/web_contents_view.h" 11 #include "content/public/browser/web_contents_view.h"
12 12
13 AutofillExternalDelegate* AutofillExternalDelegate::Create( 13 AutofillExternalDelegate* AutofillExternalDelegate::Create(
14 TabContents* tab_contents, 14 TabContents* tab_contents,
15 AutofillManager* autofill_manager) { 15 AutofillManager* autofill_manager) {
16 return new AutofillExternalDelegateGtk(tab_contents, 16 return new AutofillExternalDelegateGtk(tab_contents, autofill_manager);
17 autofill_manager);
18 } 17 }
19 18
20 AutofillExternalDelegateGtk::AutofillExternalDelegateGtk( 19 AutofillExternalDelegateGtk::AutofillExternalDelegateGtk(
21 TabContents* tab_contents, 20 TabContents* tab_contents,
22 AutofillManager* autofill_manager) 21 AutofillManager* autofill_manager)
23 : AutofillExternalDelegate(tab_contents, autofill_manager), 22 : AutofillExternalDelegate(tab_contents, autofill_manager),
24 web_contents_(tab_contents->web_contents()),
25 event_handler_id_(0) { 23 event_handler_id_(0) {
26 tab_native_view_ = web_contents_->GetView()->GetNativeView(); 24 tab_native_view_ = web_contents()->GetView()->GetNativeView();
27 } 25 }
28 26
29 AutofillExternalDelegateGtk::~AutofillExternalDelegateGtk() { 27 AutofillExternalDelegateGtk::~AutofillExternalDelegateGtk() {
30 } 28 }
31 29
32 void AutofillExternalDelegateGtk::HideAutofillPopupInternal() { 30 void AutofillExternalDelegateGtk::HideAutofillPopupInternal() {
33 if (!view_.get()) 31 if (!view_.get())
34 return; 32 return;
35 33
36 view_->Hide(); 34 view_->Hide();
(...skipping 25 matching lines...) Expand all
62 60
63 void AutofillExternalDelegateGtk::SetBounds(const gfx::Rect& bounds) { 61 void AutofillExternalDelegateGtk::SetBounds(const gfx::Rect& bounds) {
64 CreateViewIfNeeded(); 62 CreateViewIfNeeded();
65 view_->set_element_bounds(bounds); 63 view_->set_element_bounds(bounds);
66 } 64 }
67 65
68 void AutofillExternalDelegateGtk::CreateViewIfNeeded() { 66 void AutofillExternalDelegateGtk::CreateViewIfNeeded() {
69 if (view_.get()) 67 if (view_.get())
70 return; 68 return;
71 69
72 view_.reset(new AutofillPopupViewGtk(web_contents_, 70 view_.reset(new AutofillPopupViewGtk(web_contents(),
73 GtkThemeService::GetFrom(profile()), 71 GtkThemeService::GetFrom(profile()),
74 this, 72 this,
75 tab_native_view_)); 73 tab_native_view_));
76 74
77 GtkWidget* toplevel = gtk_widget_get_toplevel(tab_native_view_); 75 GtkWidget* toplevel = gtk_widget_get_toplevel(tab_native_view_);
78 if (!g_signal_handler_is_connected(toplevel, event_handler_id_)) { 76 if (!g_signal_handler_is_connected(toplevel, event_handler_id_)) {
79 event_handler_id_ = g_signal_connect( 77 event_handler_id_ = g_signal_connect(
80 toplevel, 78 toplevel,
81 "focus-out-event", 79 "focus-out-event",
82 G_CALLBACK(HandleViewFocusOutThunk), 80 G_CALLBACK(HandleViewFocusOutThunk),
83 this); 81 this);
84 } 82 }
85 } 83 }
86 84
87 gboolean AutofillExternalDelegateGtk::HandleViewFocusOut(GtkWidget* sender, 85 gboolean AutofillExternalDelegateGtk::HandleViewFocusOut(GtkWidget* sender,
88 GdkEventFocus* event) { 86 GdkEventFocus* event) {
89 HideAutofillPopup(); 87 HideAutofillPopup();
90 88
91 return TRUE; 89 return TRUE;
92 } 90 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/autofill/autofill_external_delegate_gtk.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698