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/ui/views/first_run_bubble.h" | 5 #include "chrome/browser/ui/views/first_run_bubble.h" |
6 | 6 |
7 #include "chrome/browser/first_run/first_run.h" | 7 #include "chrome/browser/first_run/first_run.h" |
8 #include "chrome/browser/search_engines/util.h" | 8 #include "chrome/browser/search_engines/util.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/chrome_pages.h" | 10 #include "chrome/browser/ui/chrome_pages.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 columns->AddPaddingColumn(1, 0); | 71 columns->AddPaddingColumn(1, 0); |
72 | 72 |
73 layout->StartRow(0, 0); | 73 layout->StartRow(0, 0); |
74 layout->AddView(title); | 74 layout->AddView(title); |
75 layout->AddView(change); | 75 layout->AddView(change); |
76 layout->StartRowWithPadding(0, 0, 0, | 76 layout->StartRowWithPadding(0, 0, 0, |
77 views::kRelatedControlSmallVerticalSpacing); | 77 views::kRelatedControlSmallVerticalSpacing); |
78 layout->AddView(subtext, columns->num_columns(), 1); | 78 layout->AddView(subtext, columns->num_columns(), 1); |
79 } | 79 } |
80 | 80 |
81 gfx::Rect FirstRunBubble::GetAnchorRect() { | |
82 // Compensate for padding in anchor. | |
83 gfx::Rect rect(BubbleDelegateView::GetAnchorRect()); | |
84 rect.Inset(0, anchor_view() ? kAnchorVerticalInset : 0); | |
85 return rect; | |
86 } | |
87 | |
88 FirstRunBubble::FirstRunBubble(Browser* browser, views::View* anchor_view) | 81 FirstRunBubble::FirstRunBubble(Browser* browser, views::View* anchor_view) |
89 : views::BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_LEFT), | 82 : views::BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_LEFT), |
90 browser_(browser) { | 83 browser_(browser) { |
| 84 // Compensate for built-in vertical padding in the anchor view's image. |
| 85 set_anchor_insets( |
| 86 gfx::Insets(kAnchorVerticalInset, 0, kAnchorVerticalInset, 0)); |
91 } | 87 } |
92 | 88 |
93 FirstRunBubble::~FirstRunBubble() { | 89 FirstRunBubble::~FirstRunBubble() { |
94 } | 90 } |
95 | 91 |
96 void FirstRunBubble::LinkClicked(views::Link* source, int event_flags) { | 92 void FirstRunBubble::LinkClicked(views::Link* source, int event_flags) { |
97 first_run::LogFirstRunMetric(first_run::FIRST_RUN_BUBBLE_CHANGE_INVOKED); | 93 first_run::LogFirstRunMetric(first_run::FIRST_RUN_BUBBLE_CHANGE_INVOKED); |
98 | 94 |
99 GetWidget()->Close(); | 95 GetWidget()->Close(); |
100 if (browser_) | 96 if (browser_) |
101 chrome::ShowSearchEngineSettings(browser_); | 97 chrome::ShowSearchEngineSettings(browser_); |
102 } | 98 } |
OLD | NEW |