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