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

Side by Side Diff: chrome/browser/ui/apps/chrome_app_delegate.cc

Issue 1657933003: Fixes the interactive default browser UX for policy setting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: grt comments 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "chrome/browser/ui/apps/chrome_app_delegate.h" 5 #include "chrome/browser/ui/apps/chrome_app_delegate.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 case ShellIntegration::STATE_IS_DEFAULT: 103 case ShellIntegration::STATE_IS_DEFAULT:
104 OpenURLFromTabInternal(profile, params_); 104 OpenURLFromTabInternal(profile, params_);
105 break; 105 break;
106 case ShellIntegration::STATE_NOT_DEFAULT: 106 case ShellIntegration::STATE_NOT_DEFAULT:
107 case ShellIntegration::STATE_UNKNOWN: 107 case ShellIntegration::STATE_UNKNOWN:
108 platform_util::OpenExternal(profile, params_.url); 108 platform_util::OpenExternal(profile, params_.url);
109 break; 109 break;
110 } 110 }
111 } 111 }
112 112
113 bool IsOwnedByWorker() override { return true; }
114
115 private: 113 private:
116 scoped_ptr<content::WebContents> source_; 114 scoped_ptr<content::WebContents> source_;
117 const content::OpenURLParams params_; 115 const content::OpenURLParams params_;
118 }; 116 };
119 117
120 } // namespace 118 } // namespace
121 119
122 // static 120 // static
123 void ChromeAppDelegate::RelinquishKeepAliveAfterTimeout( 121 void ChromeAppDelegate::RelinquishKeepAliveAfterTimeout(
124 const base::WeakPtr<ChromeAppDelegate>& chrome_app_delegate) { 122 const base::WeakPtr<ChromeAppDelegate>& chrome_app_delegate) {
(...skipping 26 matching lines...) Expand all
151 // This NewWindowContentsDelegate was given ownership of the incoming 149 // This NewWindowContentsDelegate was given ownership of the incoming
152 // WebContents by being assigned as its delegate within 150 // WebContents by being assigned as its delegate within
153 // ChromeAppDelegate::AddNewContents, but this is the first time 151 // ChromeAppDelegate::AddNewContents, but this is the first time
154 // NewWindowContentsDelegate actually sees the WebContents. 152 // NewWindowContentsDelegate actually sees the WebContents.
155 // Here it is captured for deletion. 153 // Here it is captured for deletion.
156 scoped_ptr<content::WebContents> owned_source(source); 154 scoped_ptr<content::WebContents> owned_source(source);
157 scoped_refptr<ShellIntegration::DefaultWebClientWorker> 155 scoped_refptr<ShellIntegration::DefaultWebClientWorker>
158 check_if_default_browser_worker = 156 check_if_default_browser_worker =
159 new ShellIntegration::DefaultBrowserWorker( 157 new ShellIntegration::DefaultBrowserWorker(
160 new OpenURLFromTabBasedOnBrowserDefault(std::move(owned_source), 158 new OpenURLFromTabBasedOnBrowserDefault(std::move(owned_source),
161 params)); 159 params),
160 true);
162 // Object lifetime notes: The OpenURLFromTabBasedOnBrowserDefault is owned 161 // Object lifetime notes: The OpenURLFromTabBasedOnBrowserDefault is owned
grt (UTC plus 2) 2016/02/03 15:39:56 should this have: check_if_default_browser_wor
Patrick Monette 2016/02/03 23:01:39 The worker here is only used to check the default
163 // by check_if_default_browser_worker. StartCheckIsDefault() takes lifetime 162 // by check_if_default_browser_worker. StartCheckIsDefault() takes lifetime
164 // ownership of check_if_default_browser_worker and will clean up after 163 // ownership of check_if_default_browser_worker and will clean up after
165 // the asynchronous tasks. 164 // the asynchronous tasks.
166 check_if_default_browser_worker->StartCheckIsDefault(); 165 check_if_default_browser_worker->StartCheckIsDefault();
167 } 166 }
168 return NULL; 167 return NULL;
169 } 168 }
170 169
171 ChromeAppDelegate::ChromeAppDelegate(scoped_ptr<ScopedKeepAlive> keep_alive) 170 ChromeAppDelegate::ChromeAppDelegate(scoped_ptr<ScopedKeepAlive> keep_alive)
172 : has_been_shown_(false), 171 : has_been_shown_(false),
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 const content::NotificationDetails& details) { 353 const content::NotificationDetails& details) {
355 switch (type) { 354 switch (type) {
356 case chrome::NOTIFICATION_APP_TERMINATING: 355 case chrome::NOTIFICATION_APP_TERMINATING:
357 if (!terminating_callback_.is_null()) 356 if (!terminating_callback_.is_null())
358 terminating_callback_.Run(); 357 terminating_callback_.Run();
359 break; 358 break;
360 default: 359 default:
361 NOTREACHED() << "Received unexpected notification"; 360 NOTREACHED() << "Received unexpected notification";
362 } 361 }
363 } 362 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698