| Index: chrome/browser/ui/browser_init.cc
|
| diff --git a/chrome/browser/ui/browser_init.cc b/chrome/browser/ui/browser_init.cc
|
| index 7aed22ff3b948dee8b99e6d8d0359446b53fd2fe..15714a346d9c5a63c156f2316696b8728a220324 100644
|
| --- a/chrome/browser/ui/browser_init.cc
|
| +++ b/chrome/browser/ui/browser_init.cc
|
| @@ -6,6 +6,7 @@
|
|
|
| #include <algorithm> // For max().
|
|
|
| +#include "base/timer.h"
|
| #include "base/compiler_specific.h"
|
| #include "base/environment.h"
|
| #include "base/event_recorder.h"
|
| @@ -57,6 +58,9 @@
|
| #include "chrome/browser/ui/browser_navigator.h"
|
| #include "chrome/browser/ui/browser_window.h"
|
| #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
|
| +#include "chrome/browser/ui/global_error_delegate.h"
|
| +#include "chrome/browser/ui/global_error_service.h"
|
| +#include "chrome/browser/ui/global_error_service_factory.h"
|
| #include "chrome/common/chrome_constants.h"
|
| #include "chrome/common/chrome_paths.h"
|
| #include "chrome/common/chrome_result_codes.h"
|
| @@ -1097,9 +1101,56 @@ void BrowserInit::LaunchWithProfile::AddInfoBarsIfNecessary(Browser* browser) {
|
| AddObsoleteSystemInfoBarIfNecessary(tab_contents);
|
| }
|
|
|
| +class TestError : public GlobalErrorDelegate {
|
| + bool HasBadge() { return true; }
|
| + bool HasMenuItem() { return true; }
|
| + int MenuItemCommandID() { return 123456; }
|
| + string16 MenuItemLabel() { return UTF8ToUTF16("Hello world"); }
|
| + void ExecuteMenuItem(Browser* browser) { fprintf(stderr, "%s\n", __func__); }
|
| +
|
| + virtual bool HasBubbleView() { return true; }
|
| + virtual string16 GetBubbleViewTitle() {
|
| + return UTF8ToUTF16("Error Title");
|
| + }
|
| + virtual string16 GetBubbleViewMessage() {
|
| + return UTF8ToUTF16("Your sparble needs fargling - "
|
| + "marble tarble warble faable?");
|
| + }
|
| + virtual string16 GetBubbleViewAcceptButtonLabel() {
|
| + return UTF8ToUTF16("Nargle");
|
| + }
|
| + virtual string16 GetBubbleViewCancelButtonLabel() {
|
| + return UTF8ToUTF16("Cancel");
|
| + }
|
| + virtual void BubbleViewDidClose() { }
|
| + virtual void BubbleViewAcceptButtonPressed() {
|
| + fprintf(stderr, "%s\n", __func__);
|
| + }
|
| + virtual void BubbleViewCancelButtonPressed() {
|
| + fprintf(stderr, "%s\n", __func__);
|
| + }
|
| +
|
| +public:
|
| + void OnTimer() {
|
| + gfx::Rect rect;
|
| + Browser* browser = BrowserList::GetLastActive();
|
| + ShowBubbleView(browser, rect);
|
| + }
|
| +
|
| + base::OneShotTimer<TestError> timer_;
|
| +};
|
| +
|
| void BrowserInit::LaunchWithProfile::AddCrashedInfoBarIfNecessary(
|
| Browser* browser,
|
| TabContentsWrapper* tab) {
|
| + fprintf(stderr, "%s\n", __func__);
|
| + TestError* error = new TestError();
|
| + GlobalErrorServiceFactory::GetForProfile(
|
| + browser->profile())->AddGlobalError(error);
|
| + error->timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(2000), error,
|
| + &TestError::OnTimer);
|
| +
|
| +
|
| // Assume that if the user is launching incognito they were previously
|
| // running incognito so that we have nothing to restore from.
|
| if (!profile_->DidLastSessionExitCleanly() && !profile_->IsOffTheRecord()) {
|
|
|