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

Side by Side Diff: chrome/browser/autofill/autofill_popup_view.cc

Issue 10987018: Share Font Code for New Autofill. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 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
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/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"
11 #include "content/public/browser/navigation_controller.h" 11 #include "content/public/browser/navigation_controller.h"
12 #include "content/public/browser/notification_service.h" 12 #include "content/public/browser/notification_service.h"
13 #include "content/public/browser/notification_source.h" 13 #include "content/public/browser/notification_source.h"
14 #include "content/public/browser/notification_types.h" 14 #include "content/public/browser/notification_types.h"
15 #include "grit/webkit_resources.h" 15 #include "grit/webkit_resources.h"
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAutofillClient.h" 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAutofillClient.h"
17 17
18 using WebKit::WebAutofillClient; 18 using WebKit::WebAutofillClient;
19 19
20 namespace { 20 namespace {
21 21
22 // Used to indicate that no line is currently selected by the user. 22 // Used to indicate that no line is currently selected by the user.
23 const int kNoSelection = -1; 23 const int kNoSelection = -1;
24 24
25 // Size difference between value text and label text in pixels.
26 const int kLabelFontSizeDelta = -2;
27
25 struct DataResource { 28 struct DataResource {
26 const char* name; 29 const char* name;
27 int id; 30 int id;
28 }; 31 };
29 32
30 const DataResource kDataResources[] = { 33 const DataResource kDataResources[] = {
31 { "americanExpressCC", IDR_AUTOFILL_CC_AMEX }, 34 { "americanExpressCC", IDR_AUTOFILL_CC_AMEX },
32 { "dinersCC", IDR_AUTOFILL_CC_DINERS }, 35 { "dinersCC", IDR_AUTOFILL_CC_DINERS },
33 { "discoverCC", IDR_AUTOFILL_CC_DISCOVER }, 36 { "discoverCC", IDR_AUTOFILL_CC_DISCOVER },
34 { "genericCC", IDR_AUTOFILL_CC_GENERIC }, 37 { "genericCC", IDR_AUTOFILL_CC_GENERIC },
(...skipping 14 matching lines...) Expand all
49 return; 52 return;
50 53
51 registrar_.Add(this, 54 registrar_.Add(this,
52 content::NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED, 55 content::NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED,
53 content::Source<content::WebContents>(web_contents)); 56 content::Source<content::WebContents>(web_contents));
54 registrar_.Add( 57 registrar_.Add(
55 this, 58 this,
56 content::NOTIFICATION_NAV_ENTRY_COMMITTED, 59 content::NOTIFICATION_NAV_ENTRY_COMMITTED,
57 content::Source<content::NavigationController>( 60 content::Source<content::NavigationController>(
58 &(web_contents->GetController()))); 61 &(web_contents->GetController())));
62
63 label_font_ = value_font_.DeriveFont(kLabelFontSizeDelta);
59 } 64 }
60 65
61 AutofillPopupView::~AutofillPopupView() {} 66 AutofillPopupView::~AutofillPopupView() {}
62 67
63 void AutofillPopupView::Hide() { 68 void AutofillPopupView::Hide() {
64 HideInternal(); 69 HideInternal();
65 70
66 external_delegate_->ClearPreviewedForm(); 71 external_delegate_->ClearPreviewedForm();
67 } 72 }
68 73
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 void AutofillPopupView::Observe(int type, 207 void AutofillPopupView::Observe(int type,
203 const content::NotificationSource& source, 208 const content::NotificationSource& source,
204 const content::NotificationDetails& details) { 209 const content::NotificationDetails& details) {
205 if (type == content::NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED) { 210 if (type == content::NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED) {
206 if (!*content::Details<bool>(details).ptr()) 211 if (!*content::Details<bool>(details).ptr())
207 Hide(); 212 Hide();
208 } else if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) { 213 } else if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) {
209 Hide(); 214 Hide();
210 } 215 }
211 } 216 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698