| 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 #ifndef UI_APP_LIST_APP_LIST_BUBBLE_BORDER_H_ | 5 #ifndef UI_APP_LIST_APP_LIST_BUBBLE_BORDER_H_ |
| 6 #define UI_APP_LIST_APP_LIST_BUBBLE_BORDER_H_ | 6 #define UI_APP_LIST_APP_LIST_BUBBLE_BORDER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "ui/views/bubble/bubble_border.h" | 10 #include "ui/views/bubble/bubble_border.h" |
| 11 | 11 |
| 12 namespace app_list { | 12 namespace app_list { |
| 13 | 13 |
| 14 // A class to paint bubble border and background. | 14 // A class to paint bubble border and background. |
| 15 class AppListBubbleBorder : public views::BubbleBorder { | 15 class AppListBubbleBorder : public views::BubbleBorder { |
| 16 public: | 16 public: |
| 17 explicit AppListBubbleBorder(views::View* app_list_view); | 17 AppListBubbleBorder(views::View* app_list_view, |
| 18 views::View* search_box_view, |
| 19 views::View* grid_view, |
| 20 views::View* results_view); |
| 18 virtual ~AppListBubbleBorder(); | 21 virtual ~AppListBubbleBorder(); |
| 19 | 22 |
| 20 int arrow_offset() const { | 23 int arrow_offset() const { return arrow_offset_; } |
| 21 return arrow_offset_; | 24 void set_arrow_offset(int arrow_offset) { arrow_offset_ = arrow_offset; } |
| 22 } | |
| 23 void set_arrow_offset(int arrow_offset) { | |
| 24 arrow_offset_ = arrow_offset; | |
| 25 } | |
| 26 | 25 |
| 27 private: | 26 private: |
| 28 void PaintModelViewBackground(gfx::Canvas* canvas, | 27 void PaintSearchBoxBackground(gfx::Canvas* canvas, |
| 29 const gfx::Rect& bounds) const; | 28 const gfx::Rect& bounds) const; |
| 30 void PaintPageSwitcherBackground(gfx::Canvas* canvas, | 29 void PaintSearchResultListBackground(gfx::Canvas* canvas, |
| 31 const gfx::Rect& bounds) const; | 30 const gfx::Rect& bounds) const; |
| 31 void PaintAppsGridBackground(gfx::Canvas* canvas, |
| 32 const gfx::Rect& bounds) const; |
| 32 | 33 |
| 33 // views::BubbleBorder overrides: | 34 // views::BubbleBorder overrides: |
| 34 virtual void GetInsets(gfx::Insets* insets) const OVERRIDE; | 35 virtual void GetInsets(gfx::Insets* insets) const OVERRIDE; |
| 35 virtual gfx::Rect GetBounds(const gfx::Rect& position_relative_to, | 36 virtual gfx::Rect GetBounds(const gfx::Rect& position_relative_to, |
| 36 const gfx::Size& contents_size) const OVERRIDE; | 37 const gfx::Size& contents_size) const OVERRIDE; |
| 37 | 38 |
| 38 // views::Border overrides: | 39 // views::Border overrides: |
| 39 virtual void Paint(const views::View& view, | 40 virtual void Paint(const views::View& view, |
| 40 gfx::Canvas* canvas) const OVERRIDE; | 41 gfx::Canvas* canvas) const OVERRIDE; |
| 41 | 42 |
| 42 // AppListView hosted inside this bubble. | 43 // AppListView hosted inside this bubble. |
| 43 views::View* app_list_view_; | 44 const views::View* app_list_view_; |
| 45 |
| 46 // Children view of AppListView that needs to paint background. |
| 47 const views::View* search_box_view_; |
| 48 const views::View* grid_view_; |
| 49 const views::View* results_view_; |
| 44 | 50 |
| 45 // Offset in pixels relative the default middle position. | 51 // Offset in pixels relative the default middle position. |
| 46 int arrow_offset_; | 52 int arrow_offset_; |
| 47 | 53 |
| 48 DISALLOW_COPY_AND_ASSIGN(AppListBubbleBorder); | 54 DISALLOW_COPY_AND_ASSIGN(AppListBubbleBorder); |
| 49 }; | 55 }; |
| 50 | 56 |
| 51 } // namespace app_list | 57 } // namespace app_list |
| 52 | 58 |
| 53 #endif // UI_APP_LIST_APP_LIST_BUBBLE_BORDER_H_ | 59 #endif // UI_APP_LIST_APP_LIST_BUBBLE_BORDER_H_ |
| OLD | NEW |