| 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/first_run/first_run.h" | 5 #include "chrome/browser/first_run/first_run.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 if (!browser || !browser->is_type_tabbed()) | 506 if (!browser || !browser->is_type_tabbed()) |
| 507 return; | 507 return; |
| 508 | 508 |
| 509 // Check the preference to determine if the bubble should be shown. | 509 // Check the preference to determine if the bubble should be shown. |
| 510 PrefService* prefs = g_browser_process->local_state(); | 510 PrefService* prefs = g_browser_process->local_state(); |
| 511 if (!prefs || !prefs->GetBoolean(prefs::kShouldShowFirstRunBubble)) { | 511 if (!prefs || !prefs->GetBoolean(prefs::kShouldShowFirstRunBubble)) { |
| 512 delete this; | 512 delete this; |
| 513 return; | 513 return; |
| 514 } | 514 } |
| 515 | 515 |
| 516 content::WebContents* contents = browser->GetSelectedWebContents(); | 516 content::WebContents* contents = browser->GetActiveWebContents(); |
| 517 if (contents && contents->GetURL().SchemeIs(chrome::kChromeUIScheme)) { | 517 if (contents && contents->GetURL().SchemeIs(chrome::kChromeUIScheme)) { |
| 518 // Suppress the first run bubble if the sync promo is showing. | 518 // Suppress the first run bubble if the sync promo is showing. |
| 519 if (contents->GetURL().host() == chrome::kChromeUISyncPromoHost) | 519 if (contents->GetURL().host() == chrome::kChromeUISyncPromoHost) |
| 520 return; | 520 return; |
| 521 | 521 |
| 522 // Suppress the first run bubble if the NTP sync promo bubble is showing. | 522 // Suppress the first run bubble if the NTP sync promo bubble is showing. |
| 523 if (contents->GetURL().host() == chrome::kChromeUINewTabHost) { | 523 if (contents->GetURL().host() == chrome::kChromeUINewTabHost) { |
| 524 NewTabUI* new_tab_ui = | 524 NewTabUI* new_tab_ui = |
| 525 NewTabUI::FromWebUIController(contents->GetWebUI()->GetController()); | 525 NewTabUI::FromWebUIController(contents->GetWebUI()->GetController()); |
| 526 if (new_tab_ui && new_tab_ui->showing_sync_bubble()) | 526 if (new_tab_ui && new_tab_ui->showing_sync_bubble()) |
| 527 return; | 527 return; |
| 528 } | 528 } |
| 529 } | 529 } |
| 530 | 530 |
| 531 // Suppress the first run bubble if a global error bubble is pending. | 531 // Suppress the first run bubble if a global error bubble is pending. |
| 532 GlobalErrorService* global_error_service = | 532 GlobalErrorService* global_error_service = |
| 533 GlobalErrorServiceFactory::GetForProfile(browser->profile()); | 533 GlobalErrorServiceFactory::GetForProfile(browser->profile()); |
| 534 if (global_error_service->GetFirstGlobalErrorWithBubbleView() != NULL) | 534 if (global_error_service->GetFirstGlobalErrorWithBubbleView() != NULL) |
| 535 return; | 535 return; |
| 536 | 536 |
| 537 // Reset the preference and notifications to avoid showing the bubble again. | 537 // Reset the preference and notifications to avoid showing the bubble again. |
| 538 prefs->SetBoolean(prefs::kShouldShowFirstRunBubble, false); | 538 prefs->SetBoolean(prefs::kShouldShowFirstRunBubble, false); |
| 539 | 539 |
| 540 // Show the bubble now and destroy this bubble launcher. | 540 // Show the bubble now and destroy this bubble launcher. |
| 541 browser->ShowFirstRunBubble(); | 541 browser->ShowFirstRunBubble(); |
| 542 delete this; | 542 delete this; |
| 543 } | 543 } |
| 544 | 544 |
| 545 } // namespace first_run | 545 } // namespace first_run |
| OLD | NEW |