| OLD | NEW |
| 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 #ifndef CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_VIEW_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "chrome/browser/tab_contents/infobar.h" | 11 #include "chrome/browser/tab_contents/infobar.h" |
| 12 #include "chrome/browser/tab_contents/infobar_container.h" | 12 #include "chrome/browser/tab_contents/infobar_container.h" |
| 13 #include "third_party/skia/include/core/SkPath.h" | 13 #include "third_party/skia/include/core/SkPath.h" |
| 14 #include "views/controls/button/button.h" | 14 #include "views/controls/button/button.h" |
| 15 #include "views/controls/menu/menu_item_view.h" |
| 16 #include "views/controls/menu/menu_runner.h" |
| 15 #include "views/focus/focus_manager.h" | 17 #include "views/focus/focus_manager.h" |
| 16 | 18 |
| 19 namespace ui { |
| 20 class MenuModel; |
| 21 } |
| 17 namespace views { | 22 namespace views { |
| 18 class ExternalFocusTracker; | 23 class ExternalFocusTracker; |
| 19 class ImageButton; | 24 class ImageButton; |
| 20 class ImageView; | 25 class ImageView; |
| 21 class Label; | 26 class Label; |
| 22 class Link; | 27 class Link; |
| 23 class LinkListener; | 28 class LinkListener; |
| 24 class MenuButton; | 29 class MenuButton; |
| 25 class TextButton; | 30 class TextButton; |
| 26 class ViewMenuDelegate; | 31 class ViewMenuDelegate; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 virtual int ContentMinimumWidth() const; | 81 virtual int ContentMinimumWidth() const; |
| 77 | 82 |
| 78 // These return x coordinates delimiting the usable area for subclasses to lay | 83 // These return x coordinates delimiting the usable area for subclasses to lay |
| 79 // out their controls. | 84 // out their controls. |
| 80 int StartX() const; | 85 int StartX() const; |
| 81 int EndX() const; | 86 int EndX() const; |
| 82 | 87 |
| 83 // Convenience getter. | 88 // Convenience getter. |
| 84 const InfoBarContainer::Delegate* container_delegate() const; | 89 const InfoBarContainer::Delegate* container_delegate() const; |
| 85 | 90 |
| 91 // Show a menu at the specified position. By invoking this InfobarView ensures |
| 92 // the menu is destroyed at the appropriate time. |
| 93 views::MenuRunner::RunResult RunMenuAt( |
| 94 ui::MenuModel* menu_model, |
| 95 views::MenuButton* button, |
| 96 views::MenuItemView::AnchorPosition anchor) WARN_UNUSED_RESULT; |
| 97 |
| 86 private: | 98 private: |
| 87 static const int kHorizontalPadding; | 99 static const int kHorizontalPadding; |
| 88 | 100 |
| 89 // InfoBar: | 101 // InfoBar: |
| 90 virtual void PlatformSpecificShow(bool animate) OVERRIDE; | 102 virtual void PlatformSpecificShow(bool animate) OVERRIDE; |
| 91 virtual void PlatformSpecificHide(bool animate) OVERRIDE; | 103 virtual void PlatformSpecificHide(bool animate) OVERRIDE; |
| 92 virtual void PlatformSpecificOnHeightsRecalculated() OVERRIDE; | 104 virtual void PlatformSpecificOnHeightsRecalculated() OVERRIDE; |
| 93 | 105 |
| 94 // views::View: | 106 // views::View: |
| 95 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; | 107 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 108 | 120 |
| 109 // Tracks and stores the last focused view which is not the InfoBar or any of | 121 // Tracks and stores the last focused view which is not the InfoBar or any of |
| 110 // its children. Used to restore focus once the InfoBar is closed. | 122 // its children. Used to restore focus once the InfoBar is closed. |
| 111 scoped_ptr<views::ExternalFocusTracker> focus_tracker_; | 123 scoped_ptr<views::ExternalFocusTracker> focus_tracker_; |
| 112 | 124 |
| 113 // The paths for the InfoBarBackground to draw, sized according to the heights | 125 // The paths for the InfoBarBackground to draw, sized according to the heights |
| 114 // above. | 126 // above. |
| 115 SkPath fill_path_; | 127 SkPath fill_path_; |
| 116 SkPath stroke_path_; | 128 SkPath stroke_path_; |
| 117 | 129 |
| 130 // Used to run the menu. |
| 131 scoped_ptr<views::MenuRunner> menu_runner_; |
| 132 |
| 118 DISALLOW_COPY_AND_ASSIGN(InfoBarView); | 133 DISALLOW_COPY_AND_ASSIGN(InfoBarView); |
| 119 }; | 134 }; |
| 120 | 135 |
| 121 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_VIEW_H_ | 136 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_VIEW_H_ |
| OLD | NEW |