OLD | NEW |
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 EXTENSIONS_BROWSER_EXTENSION_ZOOM_REQUEST_CLIENT_H_ | 5 #ifndef EXTENSIONS_BROWSER_EXTENSION_ZOOM_REQUEST_CLIENT_H_ |
6 #define EXTENSIONS_BROWSER_EXTENSION_ZOOM_REQUEST_CLIENT_H_ | 6 #define EXTENSIONS_BROWSER_EXTENSION_ZOOM_REQUEST_CLIENT_H_ |
7 | 7 |
| 8 #include "base/macros.h" |
8 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
9 #include "components/ui/zoom/zoom_controller.h" | 10 #include "components/ui/zoom/zoom_controller.h" |
10 #include "extensions/common/extension.h" | 11 #include "extensions/common/extension.h" |
11 | 12 |
12 namespace extensions { | 13 namespace extensions { |
13 | 14 |
14 class Extension; | 15 class Extension; |
15 | 16 |
16 // This class implements ZoomRequestClient in order to encapsulate a ref pointer | 17 // This class implements ZoomRequestClient in order to encapsulate a ref pointer |
17 // back to an extension requesting a zoom level change. This is important so | 18 // back to an extension requesting a zoom level change. This is important so |
18 // that zoom event observers can determine if an extension made the request | 19 // that zoom event observers can determine if an extension made the request |
19 // as opposed to direct user input. | 20 // as opposed to direct user input. |
20 class ExtensionZoomRequestClient : public ui_zoom::ZoomRequestClient { | 21 class ExtensionZoomRequestClient : public ui_zoom::ZoomRequestClient { |
21 public: | 22 public: |
22 explicit ExtensionZoomRequestClient(scoped_refptr<const Extension> extension); | 23 explicit ExtensionZoomRequestClient(scoped_refptr<const Extension> extension); |
23 | 24 |
24 bool ShouldSuppressBubble() const override; | 25 bool ShouldSuppressBubble() const override; |
25 const Extension* extension() const { return extension_.get(); } | 26 const Extension* extension() const { return extension_.get(); } |
26 | 27 |
27 private: | 28 private: |
28 ~ExtensionZoomRequestClient() override; | 29 ~ExtensionZoomRequestClient() override; |
29 scoped_refptr<const Extension> extension_; | 30 scoped_refptr<const Extension> extension_; |
30 | 31 |
31 DISALLOW_COPY_AND_ASSIGN(ExtensionZoomRequestClient); | 32 DISALLOW_COPY_AND_ASSIGN(ExtensionZoomRequestClient); |
32 }; | 33 }; |
33 | 34 |
34 } // namespace extensions | 35 } // namespace extensions |
35 | 36 |
36 #endif // EXTENSIONS_BROWSER_EXTENSION_ZOOM_REQUEST_CLIENT_H_ | 37 #endif // EXTENSIONS_BROWSER_EXTENSION_ZOOM_REQUEST_CLIENT_H_ |
OLD | NEW |