| 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/template_url_service_factory.h" | 8 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/browser/ui/browser_dialogs.h" |
| 10 #include "chrome/browser/ui/chrome_pages.h" | 11 #include "chrome/browser/ui/chrome_pages.h" |
| 11 #include "chrome/browser/ui/layout_constants.h" | 12 #include "chrome/browser/ui/layout_constants.h" |
| 12 #include "chrome/grit/generated_resources.h" | 13 #include "chrome/grit/generated_resources.h" |
| 13 #include "components/search_engines/util.h" | 14 #include "components/search_engines/util.h" |
| 14 #include "ui/base/l10n/l10n_util.h" | 15 #include "ui/base/l10n/l10n_util.h" |
| 15 #include "ui/base/resource/resource_bundle.h" | 16 #include "ui/base/resource/resource_bundle.h" |
| 16 #include "ui/views/controls/label.h" | 17 #include "ui/views/controls/label.h" |
| 17 #include "ui/views/controls/link.h" | 18 #include "ui/views/controls/link.h" |
| 18 #include "ui/views/event_monitor.h" | 19 #include "ui/views/event_monitor.h" |
| 19 #include "ui/views/layout/grid_layout.h" | 20 #include "ui/views/layout/grid_layout.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 } | 82 } |
| 82 | 83 |
| 83 FirstRunBubble::FirstRunBubble(Browser* browser, views::View* anchor_view) | 84 FirstRunBubble::FirstRunBubble(Browser* browser, views::View* anchor_view) |
| 84 : views::BubbleDialogDelegateView(anchor_view, | 85 : views::BubbleDialogDelegateView(anchor_view, |
| 85 views::BubbleBorder::TOP_LEFT), | 86 views::BubbleBorder::TOP_LEFT), |
| 86 browser_(browser), | 87 browser_(browser), |
| 87 bubble_closer_(this, anchor_view) { | 88 bubble_closer_(this, anchor_view) { |
| 88 // Compensate for built-in vertical padding in the anchor view's image. | 89 // Compensate for built-in vertical padding in the anchor view's image. |
| 89 set_anchor_view_insets(gfx::Insets( | 90 set_anchor_view_insets(gfx::Insets( |
| 90 GetLayoutConstant(LOCATION_BAR_BUBBLE_ANCHOR_VERTICAL_INSET), 0)); | 91 GetLayoutConstant(LOCATION_BAR_BUBBLE_ANCHOR_VERTICAL_INSET), 0)); |
| 92 chrome::RecordDialogCreation(chrome::DialogIdentifier::FIRST_RUN); |
| 91 } | 93 } |
| 92 | 94 |
| 93 int FirstRunBubble::GetDialogButtons() const { | 95 int FirstRunBubble::GetDialogButtons() const { |
| 94 return ui::DIALOG_BUTTON_NONE; | 96 return ui::DIALOG_BUTTON_NONE; |
| 95 } | 97 } |
| 96 | 98 |
| 97 FirstRunBubble::~FirstRunBubble() { | 99 FirstRunBubble::~FirstRunBubble() { |
| 98 } | 100 } |
| 99 | 101 |
| 100 void FirstRunBubble::LinkClicked(views::Link* source, int event_flags) { | 102 void FirstRunBubble::LinkClicked(views::Link* source, int event_flags) { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 137 |
| 136 void FirstRunBubble::FirstRunBubbleCloser::CloseBubble() { | 138 void FirstRunBubble::FirstRunBubbleCloser::CloseBubble() { |
| 137 if (!event_monitor_) | 139 if (!event_monitor_) |
| 138 return; | 140 return; |
| 139 | 141 |
| 140 event_monitor_.reset(); | 142 event_monitor_.reset(); |
| 141 DCHECK(bubble_); | 143 DCHECK(bubble_); |
| 142 bubble_->GetWidget()->Close(); | 144 bubble_->GetWidget()->Close(); |
| 143 bubble_ = nullptr; | 145 bubble_ = nullptr; |
| 144 } | 146 } |
| OLD | NEW |