OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/views/first_run_bubble.h" | 5 #include "chrome/browser/ui/views/first_run_bubble.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/first_run/first_run.h" | 9 #include "chrome/browser/first_run/first_run.h" |
10 #include "chrome/browser/search_engines/util.h" | 10 #include "chrome/browser/search_engines/util.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 layout->StartRow(0, 0); | 90 layout->StartRow(0, 0); |
91 layout->AddView(label1); | 91 layout->AddView(label1); |
92 layout->AddView(close_button, 1, 1, views::GridLayout::TRAILING, | 92 layout->AddView(close_button, 1, 1, views::GridLayout::TRAILING, |
93 views::GridLayout::LEADING); | 93 views::GridLayout::LEADING); |
94 layout->AddPaddingRow(0, views::kRelatedControlSmallVerticalSpacing); | 94 layout->AddPaddingRow(0, views::kRelatedControlSmallVerticalSpacing); |
95 | 95 |
96 layout->StartRow(0, 0); | 96 layout->StartRow(0, 0); |
97 layout->AddView(label2); | 97 layout->AddView(label2); |
98 } | 98 } |
99 | 99 |
100 gfx::Point FirstRunBubble::GetAnchorPoint() { | 100 gfx::Rect FirstRunBubble::GetAnchorRect() { |
101 // Compensate for padding in anchor. | 101 // Compensate for padding in anchor. |
102 return BubbleDelegateView::GetAnchorPoint().Add( | 102 gfx::Rect rect(BubbleDelegateView::GetAnchorRect()); |
103 gfx::Point(0, anchor_view() ? kAnchorVerticalOffset : 0)); | 103 rect.Offset(0, anchor_view() ? kAnchorVerticalOffset : 0); |
| 104 return rect; |
104 } | 105 } |
105 | 106 |
106 FirstRunBubble::FirstRunBubble( | 107 FirstRunBubble::FirstRunBubble( |
107 Profile* profile, | 108 Profile* profile, |
108 views::View* anchor_view, | 109 views::View* anchor_view, |
109 views::BubbleBorder::ArrowLocation arrow_location, | 110 views::BubbleBorder::ArrowLocation arrow_location, |
110 FirstRun::BubbleType bubble_type) | 111 FirstRun::BubbleType bubble_type) |
111 : views::BubbleDelegateView(anchor_view, arrow_location), | 112 : views::BubbleDelegateView(anchor_view, arrow_location), |
112 profile_(profile), | 113 profile_(profile), |
113 bubble_type_(bubble_type) { | 114 bubble_type_(bubble_type) { |
114 } | 115 } |
115 | 116 |
116 FirstRunBubble::~FirstRunBubble() { | 117 FirstRunBubble::~FirstRunBubble() { |
117 } | 118 } |
118 | 119 |
119 void FirstRunBubble::ButtonPressed(views::Button* sender, | 120 void FirstRunBubble::ButtonPressed(views::Button* sender, |
120 const views::Event& event) { | 121 const views::Event& event) { |
121 if (bubble_type_ == FirstRun::OEM_BUBBLE) { | 122 if (bubble_type_ == FirstRun::OEM_BUBBLE) { |
122 UserMetrics::RecordAction( | 123 UserMetrics::RecordAction( |
123 UserMetricsAction("FirstRunOEMBubbleView_Clicked")); | 124 UserMetricsAction("FirstRunOEMBubbleView_Clicked")); |
124 } | 125 } |
125 GetWidget()->Close(); | 126 GetWidget()->Close(); |
126 } | 127 } |
OLD | NEW |