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

Side by Side Diff: components/infobars/core/infobar.h

Issue 752853005: Remove dependency from infobars component to the embedder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « components/infobars.gypi ('k') | components/infobars/core/infobar.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 COMPONENTS_INFOBARS_CORE_INFOBAR_H_ 5 #ifndef COMPONENTS_INFOBARS_CORE_INFOBAR_H_
6 #define COMPONENTS_INFOBARS_CORE_INFOBAR_H_ 6 #define COMPONENTS_INFOBARS_CORE_INFOBAR_H_
7 7
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 22 matching lines...) Expand all
33 // 33 //
34 // Thus, InfoBarDelegate and InfoBar implementations can assume they share 34 // Thus, InfoBarDelegate and InfoBar implementations can assume they share
35 // lifetimes, and not NULL-check each other; but if one needs to reach back into 35 // lifetimes, and not NULL-check each other; but if one needs to reach back into
36 // the owning InfoBarManager, it must check whether that's still possible. 36 // the owning InfoBarManager, it must check whether that's still possible.
37 class InfoBar : public gfx::AnimationDelegate { 37 class InfoBar : public gfx::AnimationDelegate {
38 public: 38 public:
39 // These are the types passed as Details for infobar-related notifications. 39 // These are the types passed as Details for infobar-related notifications.
40 typedef InfoBar AddedDetails; 40 typedef InfoBar AddedDetails;
41 typedef std::pair<InfoBar*, bool> RemovedDetails; 41 typedef std::pair<InfoBar*, bool> RemovedDetails;
42 42
43 // Platforms must define these. 43 // Those globals must be initialized by the embedder before doing calling
44 static const int kDefaultBarTargetHeight; 44 // any of the method of the component via Initialize() call.
45 static const int kSeparatorLineHeight; 45 static int gDefaultBarTargetHeight;
46 static const int kDefaultArrowTargetHeight; 46 static int gSeparatorLineHeight;
47 static const int kMaximumArrowTargetHeight; 47 static int gDefaultArrowTargetHeight;
48 static int gMaximumArrowTargetHeight;
48 // The half-width (see comments on |arrow_half_width_| below) scales to its 49 // The half-width (see comments on |arrow_half_width_| below) scales to its
49 // default and maximum values proportionally to how the height scales to its. 50 // default and maximum values proportionally to how the height scales to its.
50 static const int kDefaultArrowTargetHalfWidth; 51 static int gDefaultArrowTargetHalfWidth;
51 static const int kMaximumArrowTargetHalfWidth; 52 static int gMaximumArrowTargetHalfWidth;
52 53
53 explicit InfoBar(scoped_ptr<InfoBarDelegate> delegate); 54 explicit InfoBar(scoped_ptr<InfoBarDelegate> delegate);
54 ~InfoBar() override; 55 ~InfoBar() override;
55 56
57 // Initializes the globals by the infobar component. Must be called by the
58 // embedder to provides its own value before making any call into the
59 // component.
60 static void Initialize(int defaultBarTargetHeight,
61 int separatorLineHeight,
62 int defaultArrowTargetHeight,
63 int maximumArrowTargetHeight,
64 int defaultArrowTargetHalfWidth,
65 int maximumArrowTargetHalfWidth);
66
56 static SkColor GetTopColor(InfoBarDelegate::Type infobar_type); 67 static SkColor GetTopColor(InfoBarDelegate::Type infobar_type);
57 static SkColor GetBottomColor(InfoBarDelegate::Type infobar_type); 68 static SkColor GetBottomColor(InfoBarDelegate::Type infobar_type);
58 69
59 InfoBarManager* owner() { return owner_; } 70 InfoBarManager* owner() { return owner_; }
60 InfoBarDelegate* delegate() const { return delegate_.get(); } 71 InfoBarDelegate* delegate() const { return delegate_.get(); }
61 void set_container(InfoBarContainer* container) { container_ = container; } 72 void set_container(InfoBarContainer* container) { container_ = container; }
62 73
63 // Sets |owner_|. This also calls StoreActiveEntryUniqueID() on |delegate_|. 74 // Sets |owner_|. This also calls StoreActiveEntryUniqueID() on |delegate_|.
64 // This must only be called once as there's no way to extract an infobar from 75 // This must only be called once as there's no way to extract an infobar from
65 // its owner without deleting it, for reparenting in another tab. 76 // its owner without deleting it, for reparenting in another tab.
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 int arrow_half_width_; // Includes only fill. 153 int arrow_half_width_; // Includes only fill.
143 int bar_height_; // Includes both fill and bottom separator. 154 int bar_height_; // Includes both fill and bottom separator.
144 int bar_target_height_; 155 int bar_target_height_;
145 156
146 DISALLOW_COPY_AND_ASSIGN(InfoBar); 157 DISALLOW_COPY_AND_ASSIGN(InfoBar);
147 }; 158 };
148 159
149 } // namespace infobars 160 } // namespace infobars
150 161
151 #endif // COMPONENTS_INFOBARS_CORE_INFOBAR_H_ 162 #endif // COMPONENTS_INFOBARS_CORE_INFOBAR_H_
OLDNEW
« no previous file with comments | « components/infobars.gypi ('k') | components/infobars/core/infobar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698