Skip to content

Commit 025cf6b

Browse files
committed
Merge branch 'm41' of https://github.com/nwjs/nw.js into m41
2 parents bebdd43 + 531dc98 commit 025cf6b

File tree

5 files changed

+29
-24
lines changed

5 files changed

+29
-24
lines changed

src/browser/autofill_popup_view_views.cc

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
#include "content/nw/src/browser/autofill_popup_view_views.h"
5+
#include "chrome/browser/ui/views/autofill/autofill_popup_view_views.h"
66

7-
#include "content/nw/src/browser/autofill_popup_controller.h"
7+
#include "chrome/browser/ui/autofill/autofill_popup_controller.h"
88
#include "components/autofill/core/browser/popup_item_ids.h"
9+
#include "components/autofill/core/browser/suggestion.h"
910
#include "ui/base/resource/resource_bundle.h"
1011
#include "ui/events/keycodes/keyboard_codes.h"
1112
#include "ui/gfx/canvas.h"
12-
#include "ui/gfx/image/image.h"
13-
#include "ui/gfx/native_widget_types.h"
1413
#include "ui/gfx/geometry/point.h"
1514
#include "ui/gfx/geometry/rect.h"
15+
#include "ui/gfx/image/image.h"
16+
#include "ui/gfx/native_widget_types.h"
1617
#include "ui/gfx/text_utils.h"
1718
#include "ui/views/border.h"
1819
#include "ui/views/widget/widget.h"
@@ -48,10 +49,11 @@ void AutofillPopupViewViews::OnPaint(gfx::Canvas* canvas) {
4849
canvas->DrawColor(kPopupBackground);
4950
OnPaintBorder(canvas);
5051

51-
for (size_t i = 0; i < controller_->names().size(); ++i) {
52+
for (size_t i = 0; i < controller_->GetLineCount(); ++i) {
5253
gfx::Rect line_rect = controller_->GetRowBounds(i);
5354

54-
if (controller_->identifiers()[i] == POPUP_ITEM_ID_SEPARATOR) {
55+
if (controller_->GetSuggestionAt(i).frontend_id ==
56+
POPUP_ITEM_ID_SEPARATOR) {
5557
canvas->FillRect(line_rect, kItemTextColor);
5658
} else {
5759
DrawAutofillEntry(canvas, i, line_rect);
@@ -71,14 +73,14 @@ void AutofillPopupViewViews::DrawAutofillEntry(gfx::Canvas* canvas,
7173

7274
const bool is_rtl = controller_->IsRTL();
7375
const int value_text_width =
74-
gfx::GetStringWidth(controller_->names()[index],
75-
controller_->GetNameFontListForRow(index));
76+
gfx::GetStringWidth(controller_->GetElidedValueAt(index),
77+
controller_->GetValueFontListForRow(index));
7678
const int value_content_x = is_rtl ?
7779
entry_rect.width() - value_text_width - kEndPadding : kEndPadding;
7880

7981
canvas->DrawStringRectWithFlags(
80-
controller_->names()[index],
81-
controller_->GetNameFontListForRow(index),
82+
controller_->GetElidedValueAt(index),
83+
controller_->GetValueFontListForRow(index),
8284
controller_->IsWarning(index) ? kWarningTextColor : kValueTextColor,
8385
gfx::Rect(value_content_x,
8486
entry_rect.y(),
@@ -92,8 +94,9 @@ void AutofillPopupViewViews::DrawAutofillEntry(gfx::Canvas* canvas,
9294
// Draw the Autofill icon, if one exists
9395
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
9496
int row_height = controller_->GetRowBounds(index).height();
95-
if (!controller_->icons()[index].empty()) {
96-
int icon = controller_->GetIconResourceID(controller_->icons()[index]);
97+
if (!controller_->GetSuggestionAt(index).icon.empty()) {
98+
int icon = controller_->GetIconResourceID(
99+
controller_->GetSuggestionAt(index).icon);
97100
DCHECK_NE(-1, icon);
98101
const gfx::ImageSkia* image = rb.GetImageSkiaNamed(icon);
99102
int icon_y = entry_rect.y() + (row_height - image->height()) / 2;
@@ -105,20 +108,20 @@ void AutofillPopupViewViews::DrawAutofillEntry(gfx::Canvas* canvas,
105108
x_align_left += is_rtl ? image->width() + kIconPadding : -kIconPadding;
106109
}
107110

108-
// Draw the name text.
109-
const int subtext_width =
110-
gfx::GetStringWidth(controller_->subtexts()[index],
111-
controller_->subtext_font_list());
111+
// Draw the label text.
112+
const int label_width =
113+
gfx::GetStringWidth(controller_->GetElidedLabelAt(index),
114+
controller_->GetLabelFontList());
112115
if (!is_rtl)
113-
x_align_left -= subtext_width;
116+
x_align_left -= label_width;
114117

115118
canvas->DrawStringRectWithFlags(
116-
controller_->subtexts()[index],
117-
controller_->subtext_font_list(),
119+
controller_->GetElidedLabelAt(index),
120+
controller_->GetLabelFontList(),
118121
kItemTextColor,
119122
gfx::Rect(x_align_left,
120123
entry_rect.y(),
121-
subtext_width,
124+
label_width,
122125
entry_rect.height()),
123126
gfx::Canvas::TEXT_ALIGN_CENTER);
124127
}

src/browser/autofill_popup_view_views.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
#ifndef CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_POPUP_VIEW_VIEWS_H_
66
#define CHROME_BROWSER_UI_VIEWS_AUTOFILL_AUTOFILL_POPUP_VIEW_VIEWS_H_
77

8-
#include "content/nw/src/browser/autofill_popup_view.h"
9-
#include "content/nw/src/browser/autofill_popup_base_view.h"
8+
#include "chrome/browser/ui/autofill/autofill_popup_view.h"
9+
#include "chrome/browser/ui/views/autofill/autofill_popup_base_view.h"
1010

1111
class AutofillPopupController;
1212

src/browser/shell_content_utility_client.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#include "third_party/skia/include/core/SkBitmap.h"
2323
#include "third_party/zlib/google/zip.h"
2424
#include "ui/gfx/codec/jpeg_codec.h"
25-
#include "ui/gfx/size.h"
25+
#include "ui/gfx/geometry/size.h"
2626

2727
#include "base/debug/debugger.h"
2828

src/renderer/printing/print_web_view_helper.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include "base/strings/stringprintf.h"
1717
#include "base/strings/utf_string_conversions.h"
1818
#include "chrome/common/print_messages.h"
19-
#include "chrome/grit/browser_resources.h"
19+
//#include "chrome/grit/browser_resources.h"
2020
#include "content/public/common/web_preferences.h"
2121
#include "content/public/renderer/render_frame.h"
2222
#include "content/public/renderer/render_thread.h"

src/shell_main.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
#include "shell_content_main.h"
3636
#endif
3737

38+
using base::CommandLine;
39+
3840
#if defined(OS_WIN)
3941

4042
int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t*, int) {

0 commit comments

Comments
 (0)