Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2119)

Unified Diff: chrome/browser/chromeos/login/ui/shared_web_view.cc

Issue 2610373002: cros: Only preload the lock screen; do not reuse it. (Closed)
Patch Set: Address comments Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/login/ui/shared_web_view.cc
diff --git a/chrome/browser/chromeos/login/ui/shared_web_view.cc b/chrome/browser/chromeos/login/ui/shared_web_view.cc
deleted file mode 100644
index 5245d41f7c940a6da50fc5d81e627904f0ce1ea5..0000000000000000000000000000000000000000
--- a/chrome/browser/chromeos/login/ui/shared_web_view.cc
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/chromeos/login/ui/shared_web_view.h"
-
-#include "base/memory/ptr_util.h"
-#include "chrome/browser/chrome_notification_types.h"
-#include "chrome/browser/chromeos/login/ui/web_view_handle.h"
-#include "chrome/browser/profiles/profile.h"
-#include "content/public/browser/notification_service.h"
-#include "content/public/browser/render_view_host.h"
-#include "content/public/browser/render_widget_host.h"
-#include "content/public/browser/web_contents.h"
-#include "ui/views/controls/webview/webview.h"
-
-namespace chromeos {
-
-SharedWebView::SharedWebView(Profile* profile) : profile_(profile) {
- registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING,
- content::NotificationService::AllSources());
- memory_pressure_listener_ = base::MakeUnique<base::MemoryPressureListener>(
- base::Bind(&SharedWebView::OnMemoryPressure, base::Unretained(this)));
-}
-
-SharedWebView::~SharedWebView() {}
-
-void SharedWebView::Shutdown() {
- web_view_handle_ = nullptr;
-}
-
-bool SharedWebView::Get(const GURL& url,
- scoped_refptr<WebViewHandle>* out_handle) {
- // At the moment only one shared WebView instance is supported per profile.
- DCHECK(web_view_url_.is_empty() || web_view_url_ == url);
- web_view_url_ = url;
-
- // Ensure the WebView is not being reused simultaneously.
- DCHECK(!web_view_handle_ || web_view_handle_->HasOneRef());
-
- // Clear cached reference if it is no longer valid (ie, destroyed in task
- // manager).
- if (web_view_handle_ &&
- !web_view_handle_->web_view()
- ->GetWebContents()
- ->GetRenderViewHost()
- ->GetWidget()
- ->GetView()) {
- web_view_handle_ = nullptr;
- }
-
- // Create WebView if needed.
- bool reused = true;
- if (!web_view_handle_) {
- web_view_handle_ = new WebViewHandle(profile_);
- reused = false;
- }
-
- *out_handle = web_view_handle_;
- return reused;
-}
-
-void SharedWebView::Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
- DCHECK_EQ(chrome::NOTIFICATION_APP_TERMINATING, type);
- web_view_handle_ = nullptr;
-}
-
-void SharedWebView::OnMemoryPressure(
- base::MemoryPressureListener::MemoryPressureLevel level) {
- switch (level) {
- case base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE:
- break;
- case base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE:
- case base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL:
- web_view_handle_ = nullptr;
- break;
- }
-}
-
-} // namespace chromeos
« no previous file with comments | « chrome/browser/chromeos/login/ui/shared_web_view.h ('k') | chrome/browser/chromeos/login/ui/shared_web_view_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698