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

Side by Side Diff: chrome/browser/background/background_contents_service.cc

Issue 10537158: Add support for Ash to Notifications (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Undo accidental UserManagerImpl change Created 8 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/chromeos/locale_change_guard.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/background/background_contents_service.h" 5 #include "chrome/browser/background/background_contents_service.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 class CrashNotificationDelegate : public NotificationDelegate { 58 class CrashNotificationDelegate : public NotificationDelegate {
59 public: 59 public:
60 CrashNotificationDelegate(Profile* profile, 60 CrashNotificationDelegate(Profile* profile,
61 const Extension* extension) 61 const Extension* extension)
62 : profile_(profile), 62 : profile_(profile),
63 is_hosted_app_(extension->is_hosted_app()), 63 is_hosted_app_(extension->is_hosted_app()),
64 extension_id_(extension->id()) { 64 extension_id_(extension->id()) {
65 } 65 }
66 66
67 void Display() {} 67 virtual void Display() OVERRIDE {}
68 68
69 void Error() {} 69 virtual void Error() OVERRIDE {}
70 70
71 void Close(bool by_user) {} 71 virtual void Close(bool by_user) OVERRIDE {}
72 72
73 void Click() { 73 virtual void Click() OVERRIDE {
74 if (is_hosted_app_) { 74 if (is_hosted_app_) {
75 // There can be a race here: user clicks the balloon, and simultaneously 75 // There can be a race here: user clicks the balloon, and simultaneously
76 // reloads the sad tab for the app. So we check here to be safe before 76 // reloads the sad tab for the app. So we check here to be safe before
77 // loading the background page. 77 // loading the background page.
78 BackgroundContentsService* service = 78 BackgroundContentsService* service =
79 BackgroundContentsServiceFactory::GetForProfile(profile_); 79 BackgroundContentsServiceFactory::GetForProfile(profile_);
80 if (!service->GetAppBackgroundContents(ASCIIToUTF16(extension_id_))) 80 if (!service->GetAppBackgroundContents(ASCIIToUTF16(extension_id_)))
81 service->LoadBackgroundContentsForExtension(profile_, extension_id_); 81 service->LoadBackgroundContentsForExtension(profile_, extension_id_);
82 } else { 82 } else {
83 profile_->GetExtensionService()->ReloadExtension(extension_id_); 83 profile_->GetExtensionService()->ReloadExtension(extension_id_);
84 } 84 }
85 85
86 // Closing the balloon here should be OK, but it causes a crash on Mac 86 // Closing the balloon here should be OK, but it causes a crash on Mac
87 // http://crbug.com/78167 87 // http://crbug.com/78167
88 ScheduleCloseBalloon(extension_id_); 88 ScheduleCloseBalloon(extension_id_);
89 } 89 }
90 90
91 std::string id() const { 91 virtual std::string id() const OVERRIDE {
92 return kNotificationPrefix + extension_id_; 92 return kNotificationPrefix + extension_id_;
93 } 93 }
94 94
95 virtual content::RenderViewHost* GetRenderViewHost() const OVERRIDE {
96 return NULL;
97 }
98
95 private: 99 private:
96 virtual ~CrashNotificationDelegate() {} 100 virtual ~CrashNotificationDelegate() {}
97 101
98 Profile* profile_; 102 Profile* profile_;
99 bool is_hosted_app_; 103 bool is_hosted_app_;
100 std::string extension_id_; 104 std::string extension_id_;
101 105
102 DISALLOW_COPY_AND_ASSIGN(CrashNotificationDelegate); 106 DISALLOW_COPY_AND_ASSIGN(CrashNotificationDelegate);
103 }; 107 };
104 108
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 WebContents* new_contents, 611 WebContents* new_contents,
608 WindowOpenDisposition disposition, 612 WindowOpenDisposition disposition,
609 const gfx::Rect& initial_pos, 613 const gfx::Rect& initial_pos,
610 bool user_gesture) { 614 bool user_gesture) {
611 Browser* browser = browser::FindLastActiveWithProfile( 615 Browser* browser = browser::FindLastActiveWithProfile(
612 Profile::FromBrowserContext(new_contents->GetBrowserContext())); 616 Profile::FromBrowserContext(new_contents->GetBrowserContext()));
613 if (!browser) 617 if (!browser)
614 return; 618 return;
615 browser->AddWebContents(new_contents, disposition, initial_pos, user_gesture); 619 browser->AddWebContents(new_contents, disposition, initial_pos, user_gesture);
616 } 620 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/locale_change_guard.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698