| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_CHROMEOS_LOGIN_UI_WEB_CONTENTS_SET_BACKGROUND_COLOR_H_ | 5 #ifndef UI_VIEWS_CONTROLS_WEBVIEW_WEB_CONTENTS_SET_BACKGROUND_COLOR_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_UI_WEB_CONTENTS_SET_BACKGROUND_COLOR_H_ | 6 #define UI_VIEWS_CONTROLS_WEBVIEW_WEB_CONTENTS_SET_BACKGROUND_COLOR_H_ |
| 7 | 7 |
| 8 #include "content/public/browser/web_contents_observer.h" | 8 #include "content/public/browser/web_contents_observer.h" |
| 9 #include "content/public/browser/web_contents_user_data.h" | 9 #include "content/public/browser/web_contents_user_data.h" |
| 10 #include "ui/views/controls/webview/webview_export.h" |
| 10 | 11 |
| 11 // Defined in SkColor.h (32-bit ARGB color). | 12 // Defined in SkColor.h (32-bit ARGB color). |
| 12 using SkColor = unsigned int; | 13 using SkColor = unsigned int; |
| 13 | 14 |
| 14 namespace chromeos { | 15 namespace views { |
| 15 | 16 |
| 16 // Ensures that the background color of a given WebContents instance is always | 17 // Ensures that the background color of a given WebContents instance is always |
| 17 // set to a given color value. | 18 // set to a given color value. |
| 18 class WebContentsSetBackgroundColor | 19 class WebContentsSetBackgroundColor |
| 19 : public content::WebContentsObserver, | 20 : public content::WebContentsObserver, |
| 20 public content::WebContentsUserData<WebContentsSetBackgroundColor> { | 21 public content::WebContentsUserData<WebContentsSetBackgroundColor> { |
| 21 public: | 22 public: |
| 22 static void CreateForWebContentsWithColor(content::WebContents* web_contents, | 23 WEBVIEW_EXPORT static void CreateForWebContentsWithColor( |
| 23 SkColor color); | 24 content::WebContents* web_contents, |
| 25 SkColor color); |
| 24 | 26 |
| 25 ~WebContentsSetBackgroundColor() override; | 27 ~WebContentsSetBackgroundColor() override; |
| 26 | 28 |
| 27 private: | 29 private: |
| 28 WebContentsSetBackgroundColor(content::WebContents* web_contents, | 30 WebContentsSetBackgroundColor(content::WebContents* web_contents, |
| 29 SkColor color); | 31 SkColor color); |
| 30 | 32 |
| 31 // content::WebContentsObserver: | 33 // content::WebContentsObserver: |
| 32 void RenderViewReady() override; | 34 void RenderViewReady() override; |
| 33 void RenderViewCreated(content::RenderViewHost* render_view_host) override; | 35 void RenderViewCreated(content::RenderViewHost* render_view_host) override; |
| 34 void RenderViewHostChanged(content::RenderViewHost* old_host, | 36 void RenderViewHostChanged(content::RenderViewHost* old_host, |
| 35 content::RenderViewHost* new_host) override; | 37 content::RenderViewHost* new_host) override; |
| 36 | 38 |
| 37 SkColor color_; | 39 SkColor color_; |
| 38 | 40 |
| 39 DISALLOW_COPY_AND_ASSIGN(WebContentsSetBackgroundColor); | 41 DISALLOW_COPY_AND_ASSIGN(WebContentsSetBackgroundColor); |
| 40 }; | 42 }; |
| 41 | 43 |
| 42 } // namespace chromeos | 44 } // namespace views |
| 43 | 45 |
| 44 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_UI_WEB_CONTENTS_SET_BACKGROUND_COLOR_H_ | 46 #endif // UI_VIEWS_CONTROLS_WEBVIEW_WEB_CONTENTS_SET_BACKGROUND_COLOR_H_ |
| OLD | NEW |