OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/startup/startup_browser_creator_impl.h" | 5 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "apps/app_restore_service.h" | 10 #include "apps/app_restore_service.h" |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 const extensions::Extension* extension = | 241 const extensions::Extension* extension = |
242 extensions.GetAppByURL(autolaunch_tabs.at(i).url); | 242 extensions.GetAppByURL(autolaunch_tabs.at(i).url); |
243 if (extension) { | 243 if (extension) { |
244 CoreAppLauncherHandler::RecordAppLaunchType( | 244 CoreAppLauncherHandler::RecordAppLaunchType( |
245 extension_misc::APP_LAUNCH_AUTOLAUNCH, | 245 extension_misc::APP_LAUNCH_AUTOLAUNCH, |
246 extension->GetType()); | 246 extension->GetType()); |
247 } | 247 } |
248 } | 248 } |
249 } | 249 } |
250 | 250 |
251 bool IsNewTabURL(Profile* profile, const GURL& url) { | |
252 GURL ntp_url(chrome::kChromeUINewTabURL); | |
253 return url == ntp_url || | |
254 (url.is_empty() && profile->GetHomePage() == ntp_url); | |
255 } | |
256 | |
257 class WebContentsCloseObserver : public content::NotificationObserver { | 251 class WebContentsCloseObserver : public content::NotificationObserver { |
258 public: | 252 public: |
259 WebContentsCloseObserver() : contents_(NULL) {} | 253 WebContentsCloseObserver() : contents_(NULL) {} |
260 virtual ~WebContentsCloseObserver() {} | 254 virtual ~WebContentsCloseObserver() {} |
261 | 255 |
262 void SetContents(content::WebContents* contents) { | 256 void SetContents(content::WebContents* contents) { |
263 DCHECK(!contents_); | 257 DCHECK(!contents_); |
264 contents_ = contents; | 258 contents_ = contents; |
265 | 259 |
266 registrar_.Add(this, | 260 registrar_.Add(this, |
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
926 if (*it == sync_promo_url) { | 920 if (*it == sync_promo_url) { |
927 add_promo = false; | 921 add_promo = false; |
928 break; | 922 break; |
929 } | 923 } |
930 } | 924 } |
931 | 925 |
932 if (add_promo) { | 926 if (add_promo) { |
933 // If the first URL is the NTP, replace it with the sync promo. This | 927 // If the first URL is the NTP, replace it with the sync promo. This |
934 // behavior is desired because completing or skipping the sync promo | 928 // behavior is desired because completing or skipping the sync promo |
935 // causes a redirect to the NTP. | 929 // causes a redirect to the NTP. |
936 if (!startup_urls->empty() && IsNewTabURL(profile_, startup_urls->at(0))) | 930 if (!startup_urls->empty() && |
| 931 startup_urls->at(0) == GURL(chrome::kChromeUINewTabURL)) |
937 startup_urls->at(0) = sync_promo_url; | 932 startup_urls->at(0) = sync_promo_url; |
938 else | 933 else |
939 startup_urls->insert(startup_urls->begin(), sync_promo_url); | 934 startup_urls->insert(startup_urls->begin(), sync_promo_url); |
940 } | 935 } |
941 } | 936 } |
942 } | 937 } |
OLD | NEW |