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 "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/autofill/autofill_external_delegate.h" | 9 #include "chrome/browser/autofill/autofill_external_delegate.h" |
10 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
42 | 42 |
43 AutofillPopupView::AutofillPopupView( | 43 AutofillPopupView::AutofillPopupView( |
44 content::WebContents* web_contents, | 44 content::WebContents* web_contents, |
45 AutofillExternalDelegate* external_delegate) | 45 AutofillExternalDelegate* external_delegate) |
46 : external_delegate_(external_delegate), | 46 : external_delegate_(external_delegate), |
47 selected_line_(kNoSelection) { | 47 selected_line_(kNoSelection) { |
48 if (!web_contents) | 48 if (!web_contents) |
49 return; | 49 return; |
50 | 50 |
51 registrar_.Add(this, | 51 registrar_.Add(this, |
52 content::NOTIFICATION_WEB_CONTENTS_HIDDEN, | 52 content::NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED, |
53 content::Source<content::WebContents>(web_contents)); | 53 content::Source<content::WebContents>(web_contents)); |
54 registrar_.Add( | 54 registrar_.Add( |
55 this, | 55 this, |
56 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 56 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
57 content::Source<content::NavigationController>( | 57 content::Source<content::NavigationController>( |
58 &(web_contents->GetController()))); | 58 &(web_contents->GetController()))); |
59 } | 59 } |
60 | 60 |
61 AutofillPopupView::~AutofillPopupView() {} | 61 AutofillPopupView::~AutofillPopupView() {} |
62 | 62 |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
189 (autofill_unique_ids_[0] > 0 || | 189 (autofill_unique_ids_[0] > 0 || |
190 autofill_unique_ids_[0] == | 190 autofill_unique_ids_[0] == |
191 WebAutofillClient::MenuItemIDAutocompleteEntry || | 191 WebAutofillClient::MenuItemIDAutocompleteEntry || |
192 autofill_unique_ids_[0] == WebAutofillClient::MenuItemIDPasswordEntry || | 192 autofill_unique_ids_[0] == WebAutofillClient::MenuItemIDPasswordEntry || |
193 autofill_unique_ids_[0] == WebAutofillClient::MenuItemIDDataListEntry); | 193 autofill_unique_ids_[0] == WebAutofillClient::MenuItemIDDataListEntry); |
194 } | 194 } |
195 | 195 |
196 void AutofillPopupView::Observe(int type, | 196 void AutofillPopupView::Observe(int type, |
197 const content::NotificationSource& source, | 197 const content::NotificationSource& source, |
198 const content::NotificationDetails& details) { | 198 const content::NotificationDetails& details) { |
199 if (type == content::NOTIFICATION_WEB_CONTENTS_HIDDEN | 199 bool visible = true; |
200 || type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) | 200 if (type == content::NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED) |
201 visible = *content::Details<bool>(details).ptr(); | |
202 if (!visible || type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) | |
jam
2012/05/18 23:40:51
nit: this code is not that readable. better to mak
Fady Samuel
2012/05/19 15:59:02
Done.
| |
201 Hide(); | 203 Hide(); |
202 } | 204 } |
OLD | NEW |