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

Side by Side Diff: chrome/browser/ui/views/tabs/dragged_tab_controller.cc

Issue 7015051: Re-land: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 7 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/tabs/dragged_tab_controller.h" 5 #include "chrome/browser/ui/views/tabs/dragged_tab_controller.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #include <set> 8 #include <set>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 public: 196 public:
197 DockDisplayer(DraggedTabController* controller, 197 DockDisplayer(DraggedTabController* controller,
198 const DockInfo& info) 198 const DockInfo& info)
199 : controller_(controller), 199 : controller_(controller),
200 popup_(NULL), 200 popup_(NULL),
201 popup_view_(NULL), 201 popup_view_(NULL),
202 ALLOW_THIS_IN_INITIALIZER_LIST(animation_(this)), 202 ALLOW_THIS_IN_INITIALIZER_LIST(animation_(this)),
203 hidden_(false), 203 hidden_(false),
204 in_enable_area_(info.in_enable_area()) { 204 in_enable_area_(info.in_enable_area()) {
205 #if defined(OS_WIN) 205 #if defined(OS_WIN)
206 popup_ = views::Widget::CreateWidget(); 206 popup_ = new views::Widget;
207 popup_->SetOpacity(0x00);
208 // TODO(sky): This should "just work" on Gtk now. 207 // TODO(sky): This should "just work" on Gtk now.
209 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); 208 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP);
210 params.transparent = true; 209 params.transparent = true;
211 params.keep_on_top = true; 210 params.keep_on_top = true;
212 params.bounds = info.GetPopupRect(); 211 params.bounds = info.GetPopupRect();
213 popup_->Init(params); 212 popup_->Init(params);
214 popup_->SetContentsView(new DockView(info.type())); 213 popup_->SetContentsView(new DockView(info.type()));
214 popup_->SetOpacity(0x00);
215 if (info.in_enable_area()) 215 if (info.in_enable_area())
216 animation_.Reset(1); 216 animation_.Reset(1);
217 else 217 else
218 animation_.Show(); 218 animation_.Show();
219 popup_->Show(); 219 popup_->Show();
220 #else 220 #else
221 NOTIMPLEMENTED(); 221 NOTIMPLEMENTED();
222 #endif 222 #endif
223 popup_view_ = popup_->GetNativeView(); 223 popup_view_ = popup_->GetNativeView();
224 } 224 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 animation_.Hide(); 258 animation_.Hide();
259 } 259 }
260 260
261 virtual void AnimationProgressed(const ui::Animation* animation) { 261 virtual void AnimationProgressed(const ui::Animation* animation) {
262 UpdateLayeredAlpha(); 262 UpdateLayeredAlpha();
263 } 263 }
264 264
265 virtual void AnimationEnded(const ui::Animation* animation) { 265 virtual void AnimationEnded(const ui::Animation* animation) {
266 if (!hidden_) 266 if (!hidden_)
267 return; 267 return;
268 #if defined(OS_WIN) 268 popup_->Close();
269 static_cast<views::WidgetWin*>(popup_)->Close();
270 #else
271 NOTIMPLEMENTED();
272 #endif
273 delete this; 269 delete this;
274 } 270 }
275 271
276 virtual void UpdateLayeredAlpha() { 272 virtual void UpdateLayeredAlpha() {
277 #if defined(OS_WIN)
278 double scale = in_enable_area_ ? 1 : .5; 273 double scale = in_enable_area_ ? 1 : .5;
279 static_cast<views::WidgetWin*>(popup_)->SetOpacity( 274 popup_->SetOpacity(static_cast<unsigned char>(animation_.GetCurrentValue() *
280 static_cast<BYTE>(animation_.GetCurrentValue() * scale * 255.0)); 275 scale * 255.0));
281 popup_->GetRootView()->SchedulePaint(); 276 popup_->GetRootView()->SchedulePaint();
282 #else
283 NOTIMPLEMENTED();
284 #endif
285 } 277 }
286 278
287 private: 279 private:
288 // DraggedTabController that created us. 280 // DraggedTabController that created us.
289 DraggedTabController* controller_; 281 DraggedTabController* controller_;
290 282
291 // Window we're showing. 283 // Window we're showing.
292 views::Widget* popup_; 284 views::Widget* popup_;
293 285
294 // NativeView of |popup_|. We cache this to avoid the possibility of 286 // NativeView of |popup_|. We cache this to avoid the possibility of
(...skipping 1153 matching lines...) Expand 10 before | Expand all | Expand 10 after
1448 1440
1449 bool DraggedTabController::AreTabsConsecutive() { 1441 bool DraggedTabController::AreTabsConsecutive() {
1450 for (size_t i = 1; i < drag_data_.size(); ++i) { 1442 for (size_t i = 1; i < drag_data_.size(); ++i) {
1451 if (drag_data_[i - 1].source_model_index + 1 != 1443 if (drag_data_[i - 1].source_model_index + 1 !=
1452 drag_data_[i].source_model_index) { 1444 drag_data_[i].source_model_index) {
1453 return false; 1445 return false;
1454 } 1446 }
1455 } 1447 }
1456 return true; 1448 return true;
1457 } 1449 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tabs/base_tab_strip.cc ('k') | chrome/browser/ui/views/tabs/dragged_tab_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698