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/bookmarks/bookmark_prompt_view.h" | 5 #include "chrome/browser/ui/views/bookmarks/bookmark_prompt_view.h" |
6 | 6 |
7 #include "chrome/browser/ui/bookmarks/bookmark_prompt_controller.h" | 7 #include "chrome/browser/ui/bookmarks/bookmark_prompt_controller.h" |
8 #include "grit/generated_resources.h" | 8 #include "grit/generated_resources.h" |
9 #include "ui/base/l10n/l10n_util.h" | 9 #include "ui/base/l10n/l10n_util.h" |
10 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 bookmark_bubble_ = new BookmarkPromptView(anchor_view, prefs); | 32 bookmark_bubble_ = new BookmarkPromptView(anchor_view, prefs); |
33 views::BubbleDelegateView::CreateBubble(bookmark_bubble_)->Show(); | 33 views::BubbleDelegateView::CreateBubble(bookmark_bubble_)->Show(); |
34 } | 34 } |
35 | 35 |
36 BookmarkPromptView::BookmarkPromptView(views::View* anchor_view, | 36 BookmarkPromptView::BookmarkPromptView(views::View* anchor_view, |
37 PrefService* prefs) | 37 PrefService* prefs) |
38 : BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_RIGHT), | 38 : BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_RIGHT), |
39 dismiss_link_(NULL), | 39 dismiss_link_(NULL), |
40 prefs_(prefs) { | 40 prefs_(prefs) { |
41 // Compensate for built-in vertical padding in the anchor view's image. | 41 // Compensate for built-in vertical padding in the anchor view's image. |
42 set_anchor_insets(gfx::Insets(5, 0, 5, 0)); | 42 set_anchor_view_insets(gfx::Insets(5, 0, 5, 0)); |
43 } | 43 } |
44 | 44 |
45 BookmarkPromptView::~BookmarkPromptView() { | 45 BookmarkPromptView::~BookmarkPromptView() { |
46 DCHECK_NE(this, bookmark_bubble_); | 46 DCHECK_NE(this, bookmark_bubble_); |
47 } | 47 } |
48 | 48 |
49 void BookmarkPromptView::Init() { | 49 void BookmarkPromptView::Init() { |
50 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, | 50 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, |
51 kHorizontalPadding, 0, 0)); | 51 kHorizontalPadding, 0, 0)); |
52 | 52 |
(...skipping 14 matching lines...) Expand all Loading... |
67 void BookmarkPromptView::LinkClicked(views::Link* source, int event_flags) { | 67 void BookmarkPromptView::LinkClicked(views::Link* source, int event_flags) { |
68 DCHECK_EQ(source, dismiss_link_); | 68 DCHECK_EQ(source, dismiss_link_); |
69 BookmarkPromptController::DisableBookmarkPrompt(prefs_); | 69 BookmarkPromptController::DisableBookmarkPrompt(prefs_); |
70 StartFade(false); | 70 StartFade(false); |
71 } | 71 } |
72 | 72 |
73 void BookmarkPromptView::WindowClosing() { | 73 void BookmarkPromptView::WindowClosing() { |
74 bookmark_bubble_ = NULL; | 74 bookmark_bubble_ = NULL; |
75 BookmarkPromptController::ClosingBookmarkPrompt(); | 75 BookmarkPromptController::ClosingBookmarkPrompt(); |
76 } | 76 } |
OLD | NEW |