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

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

Issue 7012031: Fix a couple of crashes related to app-crashed balloon. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 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 | no next file » | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_contents_service.h" 5 #include "chrome/browser/background_contents_service.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 } 58 }
59 59
60 void Display() {} 60 void Display() {}
61 61
62 void Error() {} 62 void Error() {}
63 63
64 void Close(bool by_user) {} 64 void Close(bool by_user) {}
65 65
66 void Click() { 66 void Click() {
67 if (is_hosted_app_) { 67 if (is_hosted_app_) {
68 BackgroundContentsServiceFactory::GetForProfile(profile_)-> 68 const Extension* extension =
69 LoadBackgroundContentsForExtension(profile_, extension_id_); 69 profile_->GetExtensionService()->GetInstalledExtension(extension_id_);
70 if (extension && extension->background_url().is_valid()) {
71 // If the app has a background page listed in the manifest, then reload
72 // the background page.
73 BackgroundContentsServiceFactory::GetForProfile(profile_)->
74 LoadBackgroundContentsForExtension(profile_, extension_id_);
75 } else if (extension) {
76 // Try to open the home page for the crashed app. If there is already an
77 // open sad tab for it, try to reload the app in that tab. If a tab
78 // cannot be opened because there is no appropriate window, then open a
79 // new window for the app.
80 if (!Browser::OpenApplicationTab(profile_, extension, SINGLETON_TAB)) {
Andrew T Wilson (Slow) 2011/05/14 01:01:37 I'm not positive this is the right behavior: 1) W
81 Browser::OpenApplicationWindow(profile_, extension,
82 extension_misc::LAUNCH_WINDOW,
83 extension->GetFullLaunchURL(),
84 NULL);
85 }
86 }
70 } else { 87 } else {
71 profile_->GetExtensionService()->ReloadExtension(extension_id_); 88 profile_->GetExtensionService()->ReloadExtension(extension_id_);
72 } 89 }
73 90
74 // Closing the balloon here should be OK, but it causes a crash on Mac 91 // Closing the balloon here should be OK, but it causes a crash on Mac
75 // http://crbug.com/78167 92 // http://crbug.com/78167
76 ScheduleCloseBalloon(extension_id_); 93 ScheduleCloseBalloon(extension_id_);
77 } 94 }
78 95
79 std::string id() const { 96 std::string id() const {
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 TabContents* new_contents, 578 TabContents* new_contents,
562 WindowOpenDisposition disposition, 579 WindowOpenDisposition disposition,
563 const gfx::Rect& initial_pos, 580 const gfx::Rect& initial_pos,
564 bool user_gesture) { 581 bool user_gesture) {
565 Browser* browser = BrowserList::GetLastActiveWithProfile( 582 Browser* browser = BrowserList::GetLastActiveWithProfile(
566 new_contents->profile()); 583 new_contents->profile());
567 if (!browser) 584 if (!browser)
568 return; 585 return;
569 browser->AddTabContents(new_contents, disposition, initial_pos, user_gesture); 586 browser->AddTabContents(new_contents, disposition, initial_pos, user_gesture);
570 } 587 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698