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

Side by Side Diff: ui/app_list/app_list_view.cc

Issue 10900018: Introduce App Launcher for Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: First round of feedback Created 8 years, 3 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 | Annotate | Revision Log
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 #include "ui/app_list/app_list_view.h" 5 #include "ui/app_list/app_list_view.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "ui/app_list/app_list_bubble_border.h" 8 #include "ui/app_list/app_list_bubble_border.h"
9 #include "ui/app_list/app_list_item_view.h" 9 #include "ui/app_list/app_list_item_view.h"
10 #include "ui/app_list/app_list_model.h" 10 #include "ui/app_list/app_list_model.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 AppListView::~AppListView() { 45 AppListView::~AppListView() {
46 // Deletes all child views while the models are still valid. 46 // Deletes all child views while the models are still valid.
47 RemoveAllChildViews(true); 47 RemoveAllChildViews(true);
48 } 48 }
49 49
50 void AppListView::InitAsBubble( 50 void AppListView::InitAsBubble(
51 gfx::NativeView parent, 51 gfx::NativeView parent,
52 PaginationModel* pagination_model, 52 PaginationModel* pagination_model,
53 views::View* anchor, 53 views::View* anchor,
54 const gfx::Point& anchor_point,
54 views::BubbleBorder::ArrowLocation arrow_location) { 55 views::BubbleBorder::ArrowLocation arrow_location) {
56 #if defined(OS_WIN)
57 set_background(views::Background::CreateSolidBackground(
58 AppListBubbleBorder::ContentsBackgroundColor()));
59 #else
55 set_background(NULL); 60 set_background(NULL);
61 #endif
56 62
57 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, 63 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical,
58 kInnerPadding, 64 kInnerPadding,
59 kInnerPadding, 65 kInnerPadding,
60 kInnerPadding)); 66 kInnerPadding));
61 67
62 search_box_view_ = new SearchBoxView(this); 68 search_box_view_ = new SearchBoxView(this);
63 AddChildView(search_box_view_); 69 AddChildView(search_box_view_);
64 70
65 contents_view_ = new ContentsView(this, pagination_model); 71 contents_view_ = new ContentsView(this, pagination_model);
66 AddChildView(contents_view_); 72 AddChildView(contents_view_);
67 73
68 search_box_view_->set_contents_view(contents_view_); 74 search_box_view_->set_contents_view(contents_view_);
69 75
70 set_anchor_view(anchor); 76 set_anchor_view(anchor);
77 set_anchor_point(anchor_point);
71 set_margins(gfx::Insets()); 78 set_margins(gfx::Insets());
72 set_move_with_anchor(true); 79 set_move_with_anchor(true);
73 set_parent_window(parent); 80 set_parent_window(parent);
74 set_close_on_deactivate(false); 81 set_close_on_deactivate(false);
75 set_anchor_insets(gfx::Insets(kArrowOffset, kArrowOffset, kArrowOffset, 82 set_anchor_insets(gfx::Insets(kArrowOffset, kArrowOffset, kArrowOffset,
76 kArrowOffset)); 83 kArrowOffset));
77 views::BubbleDelegateView::CreateBubble(this); 84 views::BubbleDelegateView::CreateBubble(this);
78 85
79 // Overrides border with AppListBubbleBorder. 86 // Overrides border with AppListBubbleBorder.
80 bubble_border_ = new AppListBubbleBorder(this, search_box_view_); 87 bubble_border_ = new AppListBubbleBorder(this, search_box_view_);
81 GetBubbleFrameView()->SetBubbleBorder(bubble_border_); 88 GetBubbleFrameView()->SetBubbleBorder(bubble_border_);
82 SetBubbleArrowLocation(arrow_location); 89 SetBubbleArrowLocation(arrow_location);
83 90
91 #if !defined(OS_WIN)
84 // Resets default background since AppListBubbleBorder paints background. 92 // Resets default background since AppListBubbleBorder paints background.
85 GetBubbleFrameView()->set_background(NULL); 93 GetBubbleFrameView()->set_background(NULL);
94 #endif
86 95
87 CreateModel(); 96 CreateModel();
88 } 97 }
89 98
90 void AppListView::SetBubbleArrowLocation( 99 void AppListView::SetBubbleArrowLocation(
91 views::BubbleBorder::ArrowLocation arrow_location) { 100 views::BubbleBorder::ArrowLocation arrow_location) {
92 DCHECK(bubble_border_); 101 DCHECK(bubble_border_);
93 bubble_border_->set_arrow_location(arrow_location); 102 bubble_border_->set_arrow_location(arrow_location);
94 SizeToContents(); // Recalcuates with new border. 103 SizeToContents(); // Recalcuates with new border.
95 } 104 }
(...skipping 19 matching lines...) Expand all
115 contents_view_->SetModel(new_model.get()); 124 contents_view_->SetModel(new_model.get());
116 125
117 model_.reset(new_model.release()); 126 model_.reset(new_model.release());
118 } 127 }
119 } 128 }
120 129
121 views::View* AppListView::GetInitiallyFocusedView() { 130 views::View* AppListView::GetInitiallyFocusedView() {
122 return search_box_view_->search_box(); 131 return search_box_view_->search_box();
123 } 132 }
124 133
134 gfx::ImageSkia AppListView::GetWindowAppIcon() {
135 if (delegate_.get())
136 return delegate_->GetWindowAppIcon();
137
138 return gfx::ImageSkia();
139 }
140
125 bool AppListView::HasHitTestMask() const { 141 bool AppListView::HasHitTestMask() const {
126 return true; 142 return true;
127 } 143 }
128 144
129 void AppListView::GetHitTestMask(gfx::Path* mask) const { 145 void AppListView::GetHitTestMask(gfx::Path* mask) const {
130 DCHECK(mask); 146 DCHECK(mask);
131 bubble_border_->GetMask(GetBubbleFrameView()->bounds(), mask); 147 bubble_border_->GetMask(GetBubbleFrameView()->bounds(), mask);
132 } 148 }
133 149
134 bool AppListView::OnKeyPressed(const ui::KeyEvent& event) { 150 bool AppListView::OnKeyPressed(const ui::KeyEvent& event) {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 } 210 }
195 211
196 void AppListView::InvokeResultAction(const SearchResult& result, 212 void AppListView::InvokeResultAction(const SearchResult& result,
197 int action_index, 213 int action_index,
198 int event_flags) { 214 int event_flags) {
199 if (delegate_.get()) 215 if (delegate_.get())
200 delegate_->InvokeSearchResultAction(result, action_index, event_flags); 216 delegate_->InvokeSearchResultAction(result, action_index, event_flags);
201 } 217 }
202 218
203 } // namespace app_list 219 } // namespace app_list
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698