| 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_SHARED_WEB_VIEW_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_UI_SHARED_WEB_VIEW_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_UI_SHARED_WEB_VIEW_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_UI_SHARED_WEB_VIEW_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 explicit SharedWebView(Profile* profile); | 30 explicit SharedWebView(Profile* profile); |
| 31 ~SharedWebView() override; | 31 ~SharedWebView() override; |
| 32 void Shutdown() override; | 32 void Shutdown() override; |
| 33 | 33 |
| 34 // Stores a webview instance inside of |out_handle|. |url| is the initial | 34 // Stores a webview instance inside of |out_handle|. |url| is the initial |
| 35 // URL that the webview stores (note: this function does not perform the | 35 // URL that the webview stores (note: this function does not perform the |
| 36 // navigation). This returns true if the webview was reused, false if it | 36 // navigation). This returns true if the webview was reused, false if it |
| 37 // was freshly created. | 37 // was freshly created. |
| 38 bool Get(const GURL& url, scoped_refptr<WebViewHandle>* out_handle); | 38 bool Get(const GURL& url, scoped_refptr<WebViewHandle>* out_handle); |
| 39 | 39 |
| 40 // Returns true if there is an attached views::WebView instance. |
| 41 bool has_web_view() const { return !!web_view_handle_; } |
| 42 |
| 40 private: | 43 private: |
| 41 // content::NotificationObserver: | 44 // content::NotificationObserver: |
| 42 void Observe(int type, | 45 void Observe(int type, |
| 43 const content::NotificationSource& source, | 46 const content::NotificationSource& source, |
| 44 const content::NotificationDetails& details) override; | 47 const content::NotificationDetails& details) override; |
| 45 | 48 |
| 46 // Called when there is a memory pressure event. | 49 // Called when there is a memory pressure event. |
| 47 void OnMemoryPressure( | 50 void OnMemoryPressure( |
| 48 base::MemoryPressureListener::MemoryPressureLevel level); | 51 base::MemoryPressureListener::MemoryPressureLevel level); |
| 49 | 52 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 61 scoped_refptr<WebViewHandle> web_view_handle_; | 64 scoped_refptr<WebViewHandle> web_view_handle_; |
| 62 | 65 |
| 63 std::unique_ptr<base::MemoryPressureListener> memory_pressure_listener_; | 66 std::unique_ptr<base::MemoryPressureListener> memory_pressure_listener_; |
| 64 | 67 |
| 65 DISALLOW_COPY_AND_ASSIGN(SharedWebView); | 68 DISALLOW_COPY_AND_ASSIGN(SharedWebView); |
| 66 }; | 69 }; |
| 67 | 70 |
| 68 } // namespace chromeos | 71 } // namespace chromeos |
| 69 | 72 |
| 70 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_UI_SHARED_WEB_VIEW_H_ | 73 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_UI_SHARED_WEB_VIEW_H_ |
| OLD | NEW |