| OLD | NEW |
| 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/autofill/autofill_popup_view.h" | 5 #include "chrome/browser/autofill/autofill_popup_view.h" |
| 6 | 6 |
| 7 #include "content/public/browser/web_contents.h" | 7 #include "content/public/browser/web_contents.h" |
| 8 #include "content/public/browser/navigation_controller.h" | 8 #include "content/public/browser/navigation_controller.h" |
| 9 #include "content/public/browser/notification_service.h" | 9 #include "content/public/browser/notification_service.h" |
| 10 #include "content/public/browser/notification_source.h" | 10 #include "content/public/browser/notification_source.h" |
| 11 #include "content/public/browser/notification_types.h" | 11 #include "content/public/browser/notification_types.h" |
| 12 | 12 |
| 13 AutofillPopupView::AutofillPopupView(content::WebContents* web_contents) { | 13 AutofillPopupView::AutofillPopupView(content::WebContents* web_contents) { |
| 14 registrar_.Add(this, | 14 registrar_.Add(this, |
| 15 content::NOTIFICATION_WEB_CONTENTS_HIDDEN, | 15 content::NOTIFICATION_WEB_CONTENTS_HIDDEN, |
| 16 content::Source<content::WebContents>(web_contents)); | 16 content::Source<content::WebContents>(web_contents)); |
| 17 registrar_.Add( | 17 registrar_.Add( |
| 18 this, | 18 this, |
| 19 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 19 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
| 20 content::Source<content::NavigationController>( | 20 content::Source<content::NavigationController>( |
| 21 &(web_contents->GetController()))); | 21 &(web_contents->GetController()))); |
| 22 } | 22 } |
| 23 | 23 |
| 24 AutofillPopupView::~AutofillPopupView() {} | 24 AutofillPopupView::~AutofillPopupView() {} |
| 25 | 25 |
| 26 void AutofillPopupView::Show(const std::vector<string16>& autofill_values, |
| 27 const std::vector<string16>& autofill_labels, |
| 28 const std::vector<string16>& autofill_icons, |
| 29 const std::vector<int>& autofill_unique_ids, |
| 30 int separator_index) { |
| 31 autofill_values_ = autofill_values; |
| 32 autofill_labels_ = autofill_labels; |
| 33 autofill_icons_ = autofill_icons; |
| 34 autofill_unique_ids_ = autofill_unique_ids; |
| 35 |
| 36 separator_index_ = separator_index; |
| 37 |
| 38 ShowInternal(); |
| 39 } |
| 40 |
| 26 void AutofillPopupView::Observe(int type, | 41 void AutofillPopupView::Observe(int type, |
| 27 const content::NotificationSource& source, | 42 const content::NotificationSource& source, |
| 28 const content::NotificationDetails& details) { | 43 const content::NotificationDetails& details) { |
| 29 if (type == content::NOTIFICATION_WEB_CONTENTS_HIDDEN | 44 if (type == content::NOTIFICATION_WEB_CONTENTS_HIDDEN |
| 30 || type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) | 45 || type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) |
| 31 Hide(); | 46 Hide(); |
| 32 } | 47 } |
| OLD | NEW |