BookmarkManager: Fix 'new folder text field size changes on clicking it' issue.
[chromium-blink-merge.git] / chrome / browser / ui / views / elevation_icon_setter.h
blob7cb5c4d0a78dd3a9db89cc70bbaac638f28e0902
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_VIEWS_ELEVATION_ICON_SETTER_H_
6 #define CHROME_BROWSER_UI_VIEWS_ELEVATION_ICON_SETTER_H_
8 #include "base/callback_forward.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h"
12 class SkBitmap;
14 namespace views {
15 class LabelButton;
18 // On Windows, badges a button with a "UAC shield" icon to indicate that
19 // clicking will trigger a UAC elevation prompt. Does nothing on other
20 // platforms.
21 class ElevationIconSetter {
22 public:
23 // |button| must be guaranteed to be alive throughout this class' lifetime!
24 // |callback| will be called if the button icon is actually changed; callers
25 // should pass a function which does a relayout on the view containing the
26 // button, to ensure the button is correctly resized as necessary.
27 ElevationIconSetter(views::LabelButton* button,
28 const base::Closure& callback);
29 ~ElevationIconSetter();
31 private:
32 void SetButtonIcon(const base::Closure& callback, scoped_ptr<SkBitmap> icon);
34 views::LabelButton* button_;
35 base::WeakPtrFactory<ElevationIconSetter> weak_factory_;
37 DISALLOW_COPY_AND_ASSIGN(ElevationIconSetter);
40 #endif // CHROME_BROWSER_UI_VIEWS_ELEVATION_ICON_SETTER_H_