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

Side by Side Diff: chrome/browser/ui/cocoa/autofill/autofill_popup_view_bridge.mm

Issue 1570783003: [Autofill] Move functions from the AutofillPopupController to AutofillPopupLayoutModel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: AutofillPopupViewHelper Created 4 years, 11 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 #import <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #include "chrome/browser/ui/cocoa/autofill/autofill_popup_view_bridge.h" 7 #include "chrome/browser/ui/cocoa/autofill/autofill_popup_view_bridge.h"
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "chrome/browser/ui/autofill/autofill_popup_controller.h" 10 #include "chrome/browser/ui/autofill/autofill_popup_controller.h"
11 #include "chrome/browser/ui/autofill/autofill_popup_view_delegate.h" 11 #include "chrome/browser/ui/autofill/autofill_popup_view_delegate.h"
12 #import "chrome/browser/ui/cocoa/autofill/autofill_popup_view_cocoa.h" 12 #import "chrome/browser/ui/cocoa/autofill/autofill_popup_view_cocoa.h"
13 #include "ui/gfx/geometry/rect.h" 13 #include "ui/gfx/geometry/rect.h"
14 14
15 namespace autofill { 15 namespace autofill {
16 16
17 AutofillPopupViewBridge::AutofillPopupViewBridge( 17 AutofillPopupViewBridge::AutofillPopupViewBridge(
18 AutofillPopupController* controller) 18 AutofillPopupController* controller)
19 : controller_(controller) { 19 : view_helper_(new AutofillPopupViewHelper(controller)),
20 view_.reset( 20 controller_(controller) {
21 [[AutofillPopupViewCocoa alloc] initWithController:controller 21 view_.reset([[AutofillPopupViewCocoa alloc] initWithController:controller
22 frame:NSZeroRect]); 22 frame:NSZeroRect
23 delegate:this]);
23 } 24 }
24 25
25 AutofillPopupViewBridge::~AutofillPopupViewBridge() { 26 AutofillPopupViewBridge::~AutofillPopupViewBridge() {
26 [view_ controllerDestroyed]; 27 [view_ controllerDestroyed];
27 [view_ hidePopup]; 28 [view_ hidePopup];
28 } 29 }
29 30
31 gfx::Rect AutofillPopupViewBridge::GetRowBounds(size_t index) {
32 return view_helper_->GetRowBounds(index);
33 }
34
35 int AutofillPopupViewBridge::GetIconResourceID(
36 const base::string16& resource_name) {
37 return view_helper_->GetIconResourceID(resource_name);
38 }
39
30 void AutofillPopupViewBridge::Hide() { 40 void AutofillPopupViewBridge::Hide() {
31 delete this; 41 delete this;
32 } 42 }
33 43
34 void AutofillPopupViewBridge::Show() { 44 void AutofillPopupViewBridge::Show() {
35 [view_ showPopup]; 45 [view_ showPopup];
36 } 46 }
37 47
38 void AutofillPopupViewBridge::InvalidateRow(size_t row) { 48 void AutofillPopupViewBridge::InvalidateRow(size_t row) {
39 [view_ invalidateRow:row]; 49 [view_ invalidateRow:row];
40 } 50 }
41 51
42 void AutofillPopupViewBridge::UpdateBoundsAndRedrawPopup() { 52 void AutofillPopupViewBridge::UpdateBoundsAndRedrawPopup() {
43 [view_ updateBoundsAndRedrawPopup]; 53 [view_ updateBoundsAndRedrawPopup];
44 } 54 }
45 55
56 void AutofillPopupViewBridge::UpdatePopupBounds() {
57 view_helper_->UpdatePopupBounds();
58 }
59
60 int AutofillPopupViewBridge::GetAvailableWidthForRow(int row, bool with_label) {
61 return view_helper_->GetAvailableWidthForRow(row, with_label);
62 }
63
64 int AutofillPopupViewBridge::LineFromY(int y) {
65 return view_helper_->LineFromY(y);
66 }
67
68 gfx::Rect AutofillPopupViewBridge::GetPopupBounds() {
69 return view_helper_->popup_bounds();
70 }
71
46 AutofillPopupView* AutofillPopupView::Create( 72 AutofillPopupView* AutofillPopupView::Create(
47 AutofillPopupController* controller) { 73 AutofillPopupController* controller) {
48 return new AutofillPopupViewBridge(controller); 74 return new AutofillPopupViewBridge(controller);
49 } 75 }
50 76
51 } // namespace autofill 77 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698