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

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

Issue 23622020: Fixing the dynamic positioning (move with anchor) for the app launcher (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added unit test Created 7 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/views/app_list_view.h" 5 #include "ui/app_list/views/app_list_view.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "ui/app_list/app_list_constants.h" 10 #include "ui/app_list/app_list_constants.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 #endif 82 #endif
83 83
84 signin_view_ = new SigninView( 84 signin_view_ = new SigninView(
85 GetSigninDelegate(), 85 GetSigninDelegate(),
86 app_list_main_view_->GetPreferredSize().width()); 86 app_list_main_view_->GetPreferredSize().width());
87 AddChildView(signin_view_); 87 AddChildView(signin_view_);
88 88
89 OnSigninStatusChanged(); 89 OnSigninStatusChanged();
90 90
91 set_anchor_view(anchor); 91 set_anchor_view(anchor);
92 set_anchor_rect(gfx::Rect(anchor_point, gfx::Size())); 92 // In case an |anchor| is given we use the |anchor_point| as offset, otherwise
93 // we specify the |anchor_rect|.
94 if (anchor)
95 set_anchor_offset(anchor_point);
96 else
97 set_anchor_rect(gfx::Rect(anchor_point, gfx::Size()));
93 set_color(kContentsBackgroundColor); 98 set_color(kContentsBackgroundColor);
94 set_margins(gfx::Insets()); 99 set_margins(gfx::Insets());
95 set_move_with_anchor(true); 100 set_move_with_anchor(true);
96 set_parent_window(parent); 101 set_parent_window(parent);
97 set_close_on_deactivate(false); 102 set_close_on_deactivate(false);
98 set_close_on_esc(false); 103 set_close_on_esc(false);
99 set_anchor_view_insets(gfx::Insets(kArrowOffset, kArrowOffset, 104 set_anchor_view_insets(gfx::Insets(kArrowOffset, kArrowOffset,
100 kArrowOffset, kArrowOffset)); 105 kArrowOffset, kArrowOffset));
101 set_border_accepts_events(border_accepts_events); 106 set_border_accepts_events(border_accepts_events);
102 set_shadow(views::BubbleBorder::BIG_SHADOW); 107 set_shadow(views::BubbleBorder::BIG_SHADOW);
103 #if defined(USE_AURA) && defined(OS_WIN) 108 #if defined(USE_AURA) && defined(OS_WIN)
104 if (!ui::win::IsAeroGlassEnabled() || 109 if (!ui::win::IsAeroGlassEnabled() ||
105 CommandLine::ForCurrentProcess()->HasSwitch( 110 CommandLine::ForCurrentProcess()->HasSwitch(
106 switches::kDisableDwmComposition)) { 111 switches::kDisableDwmComposition)) {
107 set_shadow(views::BubbleBorder::NO_SHADOW_OPAQUE_BORDER); 112 set_shadow(views::BubbleBorder::NO_SHADOW_OPAQUE_BORDER);
108 } 113 }
109 #endif 114 #endif
110 views::BubbleDelegateView::CreateBubble(this); 115 views::BubbleDelegateView::CreateBubble(this);
111 SetBubbleArrow(arrow); 116 SetBubbleArrow(arrow);
112 117
113 #if defined(USE_AURA) 118 #if defined(USE_AURA)
114 GetWidget()->GetNativeWindow()->layer()->SetMasksToBounds(true); 119 GetWidget()->GetNativeWindow()->layer()->SetMasksToBounds(true);
115 GetBubbleFrameView()->set_background(new AppListBackground( 120 GetBubbleFrameView()->set_background(new AppListBackground(
116 GetBubbleFrameView()->bubble_border()->GetBorderCornerRadius(), 121 GetBubbleFrameView()->bubble_border()->GetBorderCornerRadius(),
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 298
294 void AppListView::OnAppListModelSigninStatusChanged() { 299 void AppListView::OnAppListModelSigninStatusChanged() {
295 OnSigninStatusChanged(); 300 OnSigninStatusChanged();
296 } 301 }
297 302
298 void AppListView::OnAppListModelCurrentUserChanged() { 303 void AppListView::OnAppListModelCurrentUserChanged() {
299 OnSigninStatusChanged(); 304 OnSigninStatusChanged();
300 } 305 }
301 306
302 } // namespace app_list 307 } // namespace app_list
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698