| OLD | NEW |
| 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/tab_contents/background_contents.h" | 5 #include "chrome/browser/tab_contents/background_contents.h" |
| 6 | 6 |
| 7 #include "chrome/browser/background/background_contents_service.h" | 7 #include "chrome/browser/background/background_contents_service.h" |
| 8 #include "chrome/browser/extensions/extension_message_service.h" | 8 #include "chrome/browser/extensions/extension_message_service.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/renderer_preferences_util.h" | 10 #include "chrome/browser/renderer_preferences_util.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 | 55 |
| 56 BackgroundContents::~BackgroundContents() { | 56 BackgroundContents::~BackgroundContents() { |
| 57 if (!tab_contents_.get()) // Will be null for unit tests. | 57 if (!tab_contents_.get()) // Will be null for unit tests. |
| 58 return; | 58 return; |
| 59 content::NotificationService::current()->Notify( | 59 content::NotificationService::current()->Notify( |
| 60 chrome::NOTIFICATION_BACKGROUND_CONTENTS_DELETED, | 60 chrome::NOTIFICATION_BACKGROUND_CONTENTS_DELETED, |
| 61 content::Source<Profile>(profile_), | 61 content::Source<Profile>(profile_), |
| 62 content::Details<BackgroundContents>(this)); | 62 content::Details<BackgroundContents>(this)); |
| 63 } | 63 } |
| 64 | 64 |
| 65 content::WebContents* BackgroundContents::web_contents() const { |
| 66 return tab_contents_.get(); |
| 67 } |
| 68 |
| 65 const GURL& BackgroundContents::GetURL() const { | 69 const GURL& BackgroundContents::GetURL() const { |
| 66 return tab_contents_.get() ? tab_contents_->GetURL() : GURL::EmptyGURL(); | 70 return tab_contents_.get() ? tab_contents_->GetURL() : GURL::EmptyGURL(); |
| 67 } | 71 } |
| 68 | 72 |
| 69 void BackgroundContents::CloseContents(WebContents* source) { | 73 void BackgroundContents::CloseContents(WebContents* source) { |
| 70 content::NotificationService::current()->Notify( | 74 content::NotificationService::current()->Notify( |
| 71 chrome::NOTIFICATION_BACKGROUND_CONTENTS_CLOSED, | 75 chrome::NOTIFICATION_BACKGROUND_CONTENTS_CLOSED, |
| 72 content::Source<Profile>(profile_), | 76 content::Source<Profile>(profile_), |
| 73 content::Details<BackgroundContents>(this)); | 77 content::Details<BackgroundContents>(this)); |
| 74 delete this; | 78 delete this; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 case chrome::NOTIFICATION_PROFILE_DESTROYED: | 128 case chrome::NOTIFICATION_PROFILE_DESTROYED: |
| 125 case content::NOTIFICATION_APP_TERMINATING: { | 129 case content::NOTIFICATION_APP_TERMINATING: { |
| 126 delete this; | 130 delete this; |
| 127 break; | 131 break; |
| 128 } | 132 } |
| 129 default: | 133 default: |
| 130 NOTREACHED() << "Unexpected notification sent."; | 134 NOTREACHED() << "Unexpected notification sent."; |
| 131 break; | 135 break; |
| 132 } | 136 } |
| 133 } | 137 } |
| OLD | NEW |