summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autofill
diff options
context:
space:
mode:
authorjoi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-14 12:53:02 +0000
committerjoi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-14 12:53:02 +0000
commit2279a33481b362478863c62d60ff84e1c7544e78 (patch)
tree2e4968deb73e2939b767040e0978b4ff22f8c6eb /chrome/browser/autofill
parent0625b50b27f6721d5e6fbe6d9868148b5590bef2 (diff)
downloadchromium_src-2279a33481b362478863c62d60ff84e1c7544e78.zip
chromium_src-2279a33481b362478863c62d60ff84e1c7544e78.tar.gz
chromium_src-2279a33481b362478863c62d60ff84e1c7544e78.tar.bz2
Move AutofillExternalDelegateGtk to chrome/browser/ui/gtk/autofill, where it belongs.
The class implementation is all to do with UI, and has dependencies on GTK UI code, so this seems a more appropriate home for it. Moving it to its rightful home also removes a couple of unwanted includes from chrome/browser/autofill/DEPS. TBR=ben@chromium.org BUG=140037 Review URL: https://chromiumcodereview.appspot.com/10828259 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151467 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autofill')
-rw-r--r--chrome/browser/autofill/DEPS2
-rw-r--r--chrome/browser/autofill/autofill_external_delegate_gtk.cc92
-rw-r--r--chrome/browser/autofill/autofill_external_delegate_gtk.h63
3 files changed, 0 insertions, 157 deletions
diff --git a/chrome/browser/autofill/DEPS b/chrome/browser/autofill/DEPS
index 7da3cb7..02881c6 100644
--- a/chrome/browser/autofill/DEPS
+++ b/chrome/browser/autofill/DEPS
@@ -30,8 +30,6 @@ include_rules = [
"!chrome/browser/ui/browser_finder.h",
"!chrome/browser/ui/browser_window.h",
"!chrome/browser/ui/chrome_pages.h",
- "!chrome/browser/ui/gtk/autofill/autofill_popup_view_gtk.h",
- "!chrome/browser/ui/gtk/gtk_theme_service.h",
"!chrome/browser/ui/tab_contents/tab_contents.h",
"!chrome/browser/webdata/autofill_entry.h",
"!chrome/browser/webdata/web_data_service.h",
diff --git a/chrome/browser/autofill/autofill_external_delegate_gtk.cc b/chrome/browser/autofill/autofill_external_delegate_gtk.cc
deleted file mode 100644
index 57df577..0000000
--- a/chrome/browser/autofill/autofill_external_delegate_gtk.cc
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/autofill/autofill_external_delegate_gtk.h"
-
-#include "chrome/browser/ui/gtk/autofill/autofill_popup_view_gtk.h"
-#include "chrome/browser/ui/gtk/gtk_theme_service.h"
-#include "chrome/browser/ui/tab_contents/tab_contents.h"
-#include "content/public/browser/web_contents.h"
-#include "content/public/browser/web_contents_view.h"
-
-AutofillExternalDelegate* AutofillExternalDelegate::Create(
- TabContents* tab_contents,
- AutofillManager* autofill_manager) {
- return new AutofillExternalDelegateGtk(tab_contents,
- autofill_manager);
-}
-
-AutofillExternalDelegateGtk::AutofillExternalDelegateGtk(
- TabContents* tab_contents,
- AutofillManager* autofill_manager)
- : AutofillExternalDelegate(tab_contents, autofill_manager),
- web_contents_(tab_contents->web_contents()),
- event_handler_id_(0) {
- tab_native_view_ = web_contents_->GetView()->GetNativeView();
-}
-
-AutofillExternalDelegateGtk::~AutofillExternalDelegateGtk() {
-}
-
-void AutofillExternalDelegateGtk::HideAutofillPopupInternal() {
- if (!view_.get())
- return;
-
- view_->Hide();
- view_.reset();
-
- GtkWidget* toplevel = gtk_widget_get_toplevel(tab_native_view_);
- g_signal_handler_disconnect(toplevel, event_handler_id_);
-}
-
-void AutofillExternalDelegateGtk::OnQueryPlatformSpecific(
- int query_id,
- const webkit::forms::FormData& form,
- const webkit::forms::FormField& field,
- const gfx::Rect& bounds) {
- CreateViewIfNeeded();
- view_->set_element_bounds(bounds);
-}
-
-void AutofillExternalDelegateGtk::ApplyAutofillSuggestions(
- const std::vector<string16>& autofill_values,
- const std::vector<string16>& autofill_labels,
- const std::vector<string16>& autofill_icons,
- const std::vector<int>& autofill_unique_ids) {
- view_->Show(autofill_values,
- autofill_labels,
- autofill_icons,
- autofill_unique_ids);
-}
-
-void AutofillExternalDelegateGtk::SetBounds(const gfx::Rect& bounds) {
- CreateViewIfNeeded();
- view_->set_element_bounds(bounds);
-}
-
-void AutofillExternalDelegateGtk::CreateViewIfNeeded() {
- if (view_.get())
- return;
-
- view_.reset(new AutofillPopupViewGtk(web_contents_,
- GtkThemeService::GetFrom(profile()),
- this,
- tab_native_view_));
-
- GtkWidget* toplevel = gtk_widget_get_toplevel(tab_native_view_);
- if (!g_signal_handler_is_connected(toplevel, event_handler_id_)) {
- event_handler_id_ = g_signal_connect(
- toplevel,
- "focus-out-event",
- G_CALLBACK(HandleViewFocusOutThunk),
- this);
- }
-}
-
-gboolean AutofillExternalDelegateGtk::HandleViewFocusOut(GtkWidget* sender,
- GdkEventFocus* event) {
- HideAutofillPopup();
-
- return TRUE;
-}
diff --git a/chrome/browser/autofill/autofill_external_delegate_gtk.h b/chrome/browser/autofill/autofill_external_delegate_gtk.h
deleted file mode 100644
index 3043f9dd..0000000
--- a/chrome/browser/autofill/autofill_external_delegate_gtk.h
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_EXTERNAL_DELEGATE_GTK_H_
-#define CHROME_BROWSER_AUTOFILL_AUTOFILL_EXTERNAL_DELEGATE_GTK_H_
-
-#include <gtk/gtk.h>
-
-#include "base/memory/scoped_ptr.h"
-#include "chrome/browser/autofill/autofill_external_delegate.h"
-#include "ui/base/gtk/gtk_signal.h"
-#include "ui/gfx/native_widget_types.h"
-
-class AutofillPopupViewGtk;
-
-namespace content {
-class WebContents;
-}
-
-class AutofillExternalDelegateGtk : public AutofillExternalDelegate {
- public:
- AutofillExternalDelegateGtk(TabContents* tab_contents,
- AutofillManager* autofill_manager);
-
- virtual ~AutofillExternalDelegateGtk();
-
- protected:
- // AutofillExternalDelegate implementations.
- virtual void HideAutofillPopupInternal() OVERRIDE;
- virtual void OnQueryPlatformSpecific(
- int query_id,
- const webkit::forms::FormData& form,
- const webkit::forms::FormField& field,
- const gfx::Rect& bounds) OVERRIDE;
- virtual void ApplyAutofillSuggestions(
- const std::vector<string16>& autofill_values,
- const std::vector<string16>& autofill_labels,
- const std::vector<string16>& autofill_icons,
- const std::vector<int>& autofill_unique_ids) OVERRIDE;
- virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;
-
- private:
- // Create a valid view to display the autofill results if one doesn't
- // currently exist.
- void CreateViewIfNeeded();
-
- CHROMEGTK_CALLBACK_1(AutofillExternalDelegateGtk, gboolean,
- HandleViewFocusOut, GdkEventFocus*);
-
- scoped_ptr<AutofillPopupViewGtk> view_;
-
- content::WebContents* web_contents_; // Weak reference.
- gfx::NativeView tab_native_view_; // Weak reference.
-
- // The handler value for the focus out event, allows us to block and unblock
- // it as needed.
- gulong event_handler_id_;
-
- DISALLOW_COPY_AND_ASSIGN(AutofillExternalDelegateGtk);
-};
-
-#endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_EXTERNAL_DELEGATE_GTK_H_