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/notifications/balloon_collection_impl.h" | 5 #include "chrome/browser/notifications/balloon_collection_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "chrome/browser/notifications/balloon.h" | 10 #include "chrome/browser/notifications/balloon.h" |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 | 362 |
363 gfx::Point BalloonCollectionImpl::Layout::OffScreenLocation() const { | 363 gfx::Point BalloonCollectionImpl::Layout::OffScreenLocation() const { |
364 gfx::Point location = GetLayoutOrigin(); | 364 gfx::Point location = GetLayoutOrigin(); |
365 switch (placement_) { | 365 switch (placement_) { |
366 case VERTICALLY_FROM_TOP_LEFT: | 366 case VERTICALLY_FROM_TOP_LEFT: |
367 case VERTICALLY_FROM_BOTTOM_LEFT: | 367 case VERTICALLY_FROM_BOTTOM_LEFT: |
368 location.Offset(0, kBalloonMaxHeight); | 368 location.Offset(0, kBalloonMaxHeight); |
369 break; | 369 break; |
370 case VERTICALLY_FROM_TOP_RIGHT: | 370 case VERTICALLY_FROM_TOP_RIGHT: |
371 case VERTICALLY_FROM_BOTTOM_RIGHT: | 371 case VERTICALLY_FROM_BOTTOM_RIGHT: |
372 location.Offset(-kBalloonMaxWidth, kBalloonMaxHeight); | 372 location.Offset(-kBalloonMaxWidth - BalloonView::GetHorizontalMargin(), |
| 373 kBalloonMaxHeight); |
373 break; | 374 break; |
374 default: | 375 default: |
375 NOTREACHED(); | 376 NOTREACHED(); |
376 break; | 377 break; |
377 } | 378 } |
378 return location; | 379 return location; |
379 } | 380 } |
380 | 381 |
381 bool BalloonCollectionImpl::Layout::RequiresOffsets() const { | 382 bool BalloonCollectionImpl::Layout::RequiresOffsets() const { |
382 // Layout schemes that grow up from the bottom require offsets; | 383 // Layout schemes that grow up from the bottom require offsets; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().work_area(); | 470 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().work_area(); |
470 #endif | 471 #endif |
471 if (work_area_ != new_work_area) { | 472 if (work_area_ != new_work_area) { |
472 work_area_.SetRect(new_work_area.x(), new_work_area.y(), | 473 work_area_.SetRect(new_work_area.x(), new_work_area.y(), |
473 new_work_area.width(), new_work_area.height()); | 474 new_work_area.width(), new_work_area.height()); |
474 changed = true; | 475 changed = true; |
475 } | 476 } |
476 | 477 |
477 return changed; | 478 return changed; |
478 } | 479 } |
OLD | NEW |