Index: trunk/src/chrome/browser/first_run/first_run.cc |
=================================================================== |
--- trunk/src/chrome/browser/first_run/first_run.cc (revision 195175) |
+++ trunk/src/chrome/browser/first_run/first_run.cc (working copy) |
@@ -10,12 +10,10 @@ |
#include "base/compiler_specific.h" |
#include "base/file_util.h" |
#include "base/lazy_instance.h" |
-#include "base/message_loop.h" |
#include "base/metrics/histogram.h" |
#include "base/path_service.h" |
#include "base/prefs/pref_service.h" |
#include "base/stringprintf.h" |
-#include "base/time.h" |
#include "base/utf_string_conversions.h" |
#include "build/build_config.h" |
#include "chrome/browser/browser_process.h" |
@@ -40,7 +38,6 @@ |
#include "chrome/browser/signin/signin_tracker.h" |
#include "chrome/browser/ui/browser.h" |
#include "chrome/browser/ui/browser_finder.h" |
-#include "chrome/browser/ui/browser_list.h" |
#include "chrome/browser/ui/global_error/global_error_service.h" |
#include "chrome/browser/ui/global_error/global_error_service_factory.h" |
#include "chrome/browser/ui/tabs/tab_strip_model.h" |
@@ -67,9 +64,6 @@ |
namespace { |
-// How long to delay showing the first run bubble (in milliseconds). |
-const int kFirstRunBubbleDelayMs = 200; |
- |
// Flags for functions of similar name. |
bool should_show_welcome_page_ = false; |
bool should_do_autofill_personal_data_manager_first_run_ = false; |
@@ -521,16 +515,12 @@ |
new FirstRunBubbleLauncher(); |
} |
-FirstRunBubbleLauncher::FirstRunBubbleLauncher() |
- : browser_(NULL) { |
- BrowserList::AddObserver(this); |
+FirstRunBubbleLauncher::FirstRunBubbleLauncher() { |
registrar_.Add(this, content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, |
content::NotificationService::AllSources()); |
} |
-FirstRunBubbleLauncher::~FirstRunBubbleLauncher() { |
- BrowserList::RemoveObserver(this); |
-} |
+FirstRunBubbleLauncher::~FirstRunBubbleLauncher() {} |
void FirstRunBubbleLauncher::Observe( |
int type, |
@@ -596,37 +586,12 @@ |
if (global_error_service->GetFirstGlobalErrorWithBubbleView() != NULL) |
return; |
- // Make sure we don't get notified again after resetting the |
- // kShowFirstRunBubbleOption preference below. |
- registrar_.Remove(this, content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, |
- content::NotificationService::AllSources()); |
- |
// Reset the preference and notifications to avoid showing the bubble again. |
prefs->SetInteger(prefs::kShowFirstRunBubbleOption, |
FIRST_RUN_BUBBLE_DONT_SHOW); |
- // Show the bubble soon. |
- browser_ = browser; |
- base::MessageLoop::current()->PostDelayedTask( |
- FROM_HERE, |
- base::Bind( |
- &FirstRunBubbleLauncher::DoShowFirstRunBubble, |
- AsWeakPtr()), |
- base::TimeDelta::FromMilliseconds(kFirstRunBubbleDelayMs)); |
-} |
- |
-void FirstRunBubbleLauncher::OnBrowserRemoved(Browser* browser) { |
- if (browser_ == browser) { |
- // Destroy this bubble launcher. |
- delete this; |
- } |
-} |
- |
-void FirstRunBubbleLauncher::DoShowFirstRunBubble() { |
- DCHECK(browser_); |
- |
// Show the bubble now and destroy this bubble launcher. |
- browser_->ShowFirstRunBubble(); |
+ browser->ShowFirstRunBubble(); |
delete this; |
} |