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

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: Cleanup 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 // TODO(benwells): Make the background painting consistent across ports.
57 // This will require not doing it in the bubble border but in the view.
xiyuan 2012/08/29 17:39:15 The reason to do it in bubble border is that it kn
benwells 2012/08/30 06:51:30 OK, for now I've removed this TODO and added one i
58 #if defined(OS_WIN)
59 set_background(views::Background::CreateSolidBackground(
60 AppListBubbleBorder::ContentsBackgroundColor()));
61 #else
55 set_background(NULL); 62 set_background(NULL);
63 #endif
56 64
57 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, 65 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical,
58 kInnerPadding, 66 kInnerPadding,
59 kInnerPadding, 67 kInnerPadding,
60 kInnerPadding)); 68 kInnerPadding));
61 69
62 search_box_view_ = new SearchBoxView(this); 70 search_box_view_ = new SearchBoxView(this);
63 AddChildView(search_box_view_); 71 AddChildView(search_box_view_);
64 72
65 contents_view_ = new ContentsView(this, pagination_model); 73 contents_view_ = new ContentsView(this, pagination_model);
66 AddChildView(contents_view_); 74 AddChildView(contents_view_);
67 75
68 search_box_view_->set_contents_view(contents_view_); 76 search_box_view_->set_contents_view(contents_view_);
69 77
70 set_anchor_view(anchor); 78 set_anchor_view(anchor);
79 set_anchor_point(anchor_point);
xiyuan 2012/08/29 17:39:15 on Windows, think you also need set_color(AppListB
benwells 2012/08/30 06:51:30 Maybe I'm missing some subtle detail but it looks
xiyuan 2012/08/30 16:50:51 We still need set_background call above because Bu
71 set_margins(gfx::Insets()); 80 set_margins(gfx::Insets());
72 set_move_with_anchor(true); 81 set_move_with_anchor(true);
73 set_parent_window(parent); 82 set_parent_window(parent);
74 set_close_on_deactivate(false); 83 set_close_on_deactivate(false);
75 set_anchor_insets(gfx::Insets(kArrowOffset, kArrowOffset, kArrowOffset, 84 set_anchor_insets(gfx::Insets(kArrowOffset, kArrowOffset, kArrowOffset,
76 kArrowOffset)); 85 kArrowOffset));
77 views::BubbleDelegateView::CreateBubble(this); 86 views::BubbleDelegateView::CreateBubble(this);
78 87
79 // Overrides border with AppListBubbleBorder. 88 // Overrides border with AppListBubbleBorder.
80 bubble_border_ = new AppListBubbleBorder(this, search_box_view_); 89 bubble_border_ = new AppListBubbleBorder(this, search_box_view_);
81 GetBubbleFrameView()->SetBubbleBorder(bubble_border_); 90 GetBubbleFrameView()->SetBubbleBorder(bubble_border_);
82 SetBubbleArrowLocation(arrow_location); 91 SetBubbleArrowLocation(arrow_location);
83 92
93 #if !defined(OS_WIN)
84 // Resets default background since AppListBubbleBorder paints background. 94 // Resets default background since AppListBubbleBorder paints background.
85 GetBubbleFrameView()->set_background(NULL); 95 GetBubbleFrameView()->set_background(NULL);
96 #endif
86 97
87 CreateModel(); 98 CreateModel();
88 } 99 }
89 100
90 void AppListView::SetBubbleArrowLocation( 101 void AppListView::SetBubbleArrowLocation(
91 views::BubbleBorder::ArrowLocation arrow_location) { 102 views::BubbleBorder::ArrowLocation arrow_location) {
92 DCHECK(bubble_border_); 103 DCHECK(bubble_border_);
93 bubble_border_->set_arrow_location(arrow_location); 104 bubble_border_->set_arrow_location(arrow_location);
94 SizeToContents(); // Recalcuates with new border. 105 SizeToContents(); // Recalcuates with new border.
95 } 106 }
(...skipping 28 matching lines...) Expand all
124 135
125 bool AppListView::HasHitTestMask() const { 136 bool AppListView::HasHitTestMask() const {
126 return true; 137 return true;
127 } 138 }
128 139
129 void AppListView::GetHitTestMask(gfx::Path* mask) const { 140 void AppListView::GetHitTestMask(gfx::Path* mask) const {
130 DCHECK(mask); 141 DCHECK(mask);
131 bubble_border_->GetMask(GetBubbleFrameView()->bounds(), mask); 142 bubble_border_->GetMask(GetBubbleFrameView()->bounds(), mask);
132 } 143 }
133 144
145 gfx::ImageSkia AppListView::GetWindowAppIcon() {
146 if (delegate_.get())
147 return delegate_->GetWindowAppIcon();
148
149 return gfx::ImageSkia();
150 }
151
134 bool AppListView::OnKeyPressed(const ui::KeyEvent& event) { 152 bool AppListView::OnKeyPressed(const ui::KeyEvent& event) {
135 if (event.key_code() == ui::VKEY_ESCAPE) { 153 if (event.key_code() == ui::VKEY_ESCAPE) {
136 Close(); 154 Close();
137 return true; 155 return true;
138 } 156 }
139 157
140 return false; 158 return false;
141 } 159 }
142 160
143 void AppListView::ButtonPressed(views::Button* sender, const ui::Event& event) { 161 void AppListView::ButtonPressed(views::Button* sender, const ui::Event& event) {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 } 212 }
195 213
196 void AppListView::InvokeResultAction(const SearchResult& result, 214 void AppListView::InvokeResultAction(const SearchResult& result,
197 int action_index, 215 int action_index,
198 int event_flags) { 216 int event_flags) {
199 if (delegate_.get()) 217 if (delegate_.get())
200 delegate_->InvokeSearchResultAction(result, action_index, event_flags); 218 delegate_->InvokeSearchResultAction(result, action_index, event_flags);
201 } 219 }
202 220
203 } // namespace app_list 221 } // namespace app_list
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698