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

Unified Diff: chrome/browser/ui/startup/default_browser_prompt_win.cc

Issue 2090773002: Improves first run dialog performance on Win8 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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/startup/default_browser_prompt_win.cc
diff --git a/chrome/browser/ui/startup/default_browser_prompt_win.cc b/chrome/browser/ui/startup/default_browser_prompt_win.cc
index 04c9cd3d42368543ae8b1f718e6bbeb7189593ff..35321bfc4ec0443e913c29377434c84bc68dd2b4 100644
--- a/chrome/browser/ui/startup/default_browser_prompt_win.cc
+++ b/chrome/browser/ui/startup/default_browser_prompt_win.cc
@@ -9,65 +9,8 @@
#include "chrome/browser/profiles/profile.h"
grt (UTC plus 2) 2016/07/19 08:13:01 i think you can remove this since this file does n
zmin 2016/07/20 16:35:45 Done.
#include "chrome/browser/shell_integration.h"
#include "chrome/browser/ui/browser.h"
grt (UTC plus 2) 2016/07/19 08:13:01 unused?
zmin 2016/07/20 16:35:45 Done.
-#include "chrome/browser/ui/browser_finder.h"
-#include "chrome/browser/ui/webui/set_as_default_browser_ui.h"
-#include "components/prefs/pref_service.h"
+#include "chrome/browser/ui/webui/set_as_default_browser_ui_win.h"
#include "components/startup_metric_utils/browser/startup_metric_utils.h"
-#include "content/public/browser/browser_thread.h"
-#include "content/public/browser/notification_service.h"
-#include "content/public/browser/notification_types.h"
-
-using content::BrowserThread;
-
-namespace {
-
-// Show the page prompting the user to make Chrome the default browser on
-// Windows 8 (which means becoming "the browser" in Metro mode). The page
-// will be shown at the first appropriate opportunity. It can be placed in
-// a tab or in a dialog, depending on other settings.
-class SetMetroBrowserFlowLauncher : public content::NotificationObserver {
- public:
- static void LaunchSoon(Profile* profile) {
- // The instance will manage its own lifetime.
- new SetMetroBrowserFlowLauncher(profile);
- }
-
- private:
- explicit SetMetroBrowserFlowLauncher(Profile* profile)
- : profile_(profile) {
- registrar_.Add(this, content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME,
- content::NotificationService::AllSources());
- }
-
- // content::NotificationObserver override:
- void Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) override;
-
- content::NotificationRegistrar registrar_;
- Profile* profile_;
-
- DISALLOW_COPY_AND_ASSIGN(SetMetroBrowserFlowLauncher);
-};
-
-void SetMetroBrowserFlowLauncher::Observe(
- int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
- DCHECK_EQ(content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, type);
-
- Browser* browser = chrome::FindBrowserWithWebContents(
- content::Source<content::WebContents>(source).ptr());
- if (!browser || !browser->is_type_tabbed())
- return;
-
- // Unregister and delete.
- registrar_.RemoveAll();
- SetAsDefaultBrowserUI::Show(profile_, browser);
- delete this;
-}
-
-} // namespace
namespace chrome {
@@ -87,7 +30,7 @@ bool ShowFirstRunDefaultBrowserPrompt(Profile* profile) {
if (show_status) {
startup_metric_utils::SetNonBrowserUIDisplayed();
- SetMetroBrowserFlowLauncher::LaunchSoon(profile);
+ SetAsDefaultBrowserUI::Show(profile);
}
return show_status;

Powered by Google App Engine
This is Rietveld 408576698