| 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/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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 void Click() { | 72 void Click() { |
| 73 if (is_hosted_app_) { | 73 if (is_hosted_app_) { |
| 74 // There can be a race here: user clicks the balloon, and simultaneously | 74 // There can be a race here: user clicks the balloon, and simultaneously |
| 75 // reloads the sad tab for the app. So we check here to be safe before | 75 // reloads the sad tab for the app. So we check here to be safe before |
| 76 // loading the background page. | 76 // loading the background page. |
| 77 BackgroundContentsService* service = | 77 BackgroundContentsService* service = |
| 78 BackgroundContentsServiceFactory::GetForProfile(profile_); | 78 BackgroundContentsServiceFactory::GetForProfile(profile_); |
| 79 if (!service->GetAppBackgroundContents(ASCIIToUTF16(extension_id_))) | 79 if (!service->GetAppBackgroundContents(ASCIIToUTF16(extension_id_))) |
| 80 service->LoadBackgroundContentsForExtension(profile_, extension_id_); | 80 service->LoadBackgroundContentsForExtension(profile_, extension_id_); |
| 81 } else { | 81 } else { |
| 82 // TODO(aa): Could we just reload the ExtensionHost instead of the entire |
| 83 // extension? |
| 82 profile_->GetExtensionService()->ReloadExtension(extension_id_); | 84 profile_->GetExtensionService()->ReloadExtension(extension_id_); |
| 83 } | 85 } |
| 84 | 86 |
| 85 // Closing the balloon here should be OK, but it causes a crash on Mac | 87 // Closing the balloon here should be OK, but it causes a crash on Mac |
| 86 // http://crbug.com/78167 | 88 // http://crbug.com/78167 |
| 87 ScheduleCloseBalloon(extension_id_); | 89 ScheduleCloseBalloon(extension_id_); |
| 88 } | 90 } |
| 89 | 91 |
| 90 std::string id() const { | 92 std::string id() const { |
| 91 return kNotificationPrefix + extension_id_; | 93 return kNotificationPrefix + extension_id_; |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 WebContents* new_contents, | 575 WebContents* new_contents, |
| 574 WindowOpenDisposition disposition, | 576 WindowOpenDisposition disposition, |
| 575 const gfx::Rect& initial_pos, | 577 const gfx::Rect& initial_pos, |
| 576 bool user_gesture) { | 578 bool user_gesture) { |
| 577 Browser* browser = BrowserList::GetLastActiveWithProfile( | 579 Browser* browser = BrowserList::GetLastActiveWithProfile( |
| 578 Profile::FromBrowserContext(new_contents->GetBrowserContext())); | 580 Profile::FromBrowserContext(new_contents->GetBrowserContext())); |
| 579 if (!browser) | 581 if (!browser) |
| 580 return; | 582 return; |
| 581 browser->AddWebContents(new_contents, disposition, initial_pos, user_gesture); | 583 browser->AddWebContents(new_contents, disposition, initial_pos, user_gesture); |
| 582 } | 584 } |
| OLD | NEW |