Home | History | Annotate | Download | only in message_center
      1 // Copyright 2013 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #include "chrome/browser/ui/views/message_center/message_center_frame_view.h"
      6 
      7 #include "ui/base/hit_test.h"
      8 #include "ui/message_center/message_center_style.h"
      9 #include "ui/views/shadow_border.h"
     10 #include "ui/views/widget/widget.h"
     11 
     12 namespace message_center {
     13 
     14 MessageCenterFrameView::MessageCenterFrameView() {
     15 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
     16   const int kBorderWidth = 1;
     17   SetBorder(views::Border::CreateSolidBorder(
     18       kBorderWidth, message_center::kMessageCenterBorderColor));
     19 #else
     20   const int kShadowBlur = 8;
     21   SetBorder(scoped_ptr<views::Border>(new views::ShadowBorder(
     22       kShadowBlur,
     23       message_center::kMessageCenterShadowColor,
     24       0,    // Vertical offset
     25       0)));  // Horizontal offset
     26 #endif
     27 }
     28 
     29 MessageCenterFrameView::~MessageCenterFrameView() {}
     30 
     31 gfx::Rect MessageCenterFrameView::GetBoundsForClientView() const {
     32   gfx::Rect client_bounds = GetLocalBounds();
     33   client_bounds.Inset(GetInsets());
     34   return client_bounds;
     35 }
     36 
     37 gfx::Rect MessageCenterFrameView::GetWindowBoundsForClientBounds(
     38     const gfx::Rect& client_bounds) const {
     39   gfx::Rect window_bounds = client_bounds;
     40   window_bounds.Inset(GetInsets());
     41   return window_bounds;
     42 }
     43 
     44 int MessageCenterFrameView::NonClientHitTest(const gfx::Point& point) {
     45   gfx::Rect frame_bounds = bounds();
     46   frame_bounds.Inset(GetInsets());
     47   if (!frame_bounds.Contains(point))
     48     return HTNOWHERE;
     49 
     50   return GetWidget()->client_view()->NonClientHitTest(point);
     51 }
     52 
     53 void MessageCenterFrameView::GetWindowMask(const gfx::Size& size,
     54                                            gfx::Path* window_mask) {
     55 }
     56 
     57 void MessageCenterFrameView::ResetWindowControls() {
     58 }
     59 
     60 void MessageCenterFrameView::UpdateWindowIcon() {
     61 }
     62 
     63 void MessageCenterFrameView::UpdateWindowTitle() {
     64 }
     65 
     66 gfx::Insets MessageCenterFrameView::GetInsets() const {
     67   return border()->GetInsets();
     68 }
     69 
     70 const char* MessageCenterFrameView::GetClassName() const {
     71   return "MessageCenterFrameView";
     72 }
     73 
     74 }  // namespace message_center
     75