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

Unified Diff: chrome/browser/ui/apps/chrome_app_delegate.cc

Issue 1708343002: Add ScopedKeepAlive to c/b/lifetime (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address PS7 comments, replace strings by a struct ptr, chromeappdelegate ctor takes a boolean Created 4 years, 10 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/ui/apps/chrome_app_delegate.cc
diff --git a/chrome/browser/ui/apps/chrome_app_delegate.cc b/chrome/browser/ui/apps/chrome_app_delegate.cc
index 8ed8e7f68876af90a12faf4a624659fe591ebf92..3b2fc9f39fc77b1a9c0b8b6d971e653e169dec0d 100644
--- a/chrome/browser/ui/apps/chrome_app_delegate.cc
+++ b/chrome/browser/ui/apps/chrome_app_delegate.cc
@@ -10,11 +10,12 @@
#include "base/memory/scoped_ptr.h"
#include "base/strings/stringprintf.h"
#include "chrome/browser/app_mode/app_mode_utils.h"
-#include "chrome/browser/apps/scoped_keep_alive.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/extensions/chrome_extension_web_contents_observer.h"
#include "chrome/browser/favicon/favicon_utils.h"
#include "chrome/browser/file_select_helper.h"
+#include "chrome/browser/lifetime/keep_alive_options.h"
+#include "chrome/browser/lifetime/scoped_keep_alive.h"
#include "chrome/browser/media/media_capture_devices_dispatcher.h"
#include "chrome/browser/platform_util.h"
#include "chrome/browser/profiles/profile.h"
@@ -57,6 +58,8 @@ int kAppWindowFirstShowTimeoutSeconds = 10;
bool disable_external_open_for_testing_ = false;
+static const KeepAliveOptions g_keep_alive_options = {"ChromeAppDelegate"};
+
// Opens a URL with Chromium (not external browser) with the right profile.
content::WebContents* OpenURLFromTabInternal(
content::BrowserContext* context,
@@ -167,12 +170,13 @@ ChromeAppDelegate::NewWindowContentsDelegate::OpenURLFromTab(
return NULL;
}
-ChromeAppDelegate::ChromeAppDelegate(scoped_ptr<ScopedKeepAlive> keep_alive)
+ChromeAppDelegate::ChromeAppDelegate(bool keep_alive)
: has_been_shown_(false),
is_hidden_(true),
- keep_alive_(std::move(keep_alive)),
new_window_contents_delegate_(new NewWindowContentsDelegate()),
weak_factory_(this) {
+ if (keep_alive)
+ keep_alive_.reset(new ScopedKeepAlive(&g_keep_alive_options));
registrar_.Add(this,
chrome::NOTIFICATION_APP_TERMINATING,
content::NotificationService::AllSources());
@@ -345,7 +349,7 @@ void ChromeAppDelegate::OnHide() {
void ChromeAppDelegate::OnShow() {
has_been_shown_ = true;
is_hidden_ = false;
- keep_alive_.reset(new ScopedKeepAlive);
+ keep_alive_.reset(new ScopedKeepAlive(&g_keep_alive_options));
}
void ChromeAppDelegate::Observe(int type,

Powered by Google App Engine
This is Rietveld 408576698