OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/tab_contents.h" | 5 #include "chrome/browser/tab_contents/tab_contents.h" |
6 | 6 |
7 #if defined(OS_CHROMEOS) | 7 #if defined(OS_CHROMEOS) |
8 // For GdkScreen | 8 // For GdkScreen |
9 #include <gdk/gdk.h> | 9 #include <gdk/gdk.h> |
10 #endif // defined(OS_CHROMEOS) | 10 #endif // defined(OS_CHROMEOS) |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 | 393 |
394 render_manager_.Init(profile, site_instance, routing_id); | 394 render_manager_.Init(profile, site_instance, routing_id); |
395 | 395 |
396 // We have the initial size of the view be based on the size of the passed in | 396 // We have the initial size of the view be based on the size of the passed in |
397 // tab contents (normally a tab from the same window). | 397 // tab contents (normally a tab from the same window). |
398 view_->CreateView(base_tab_contents ? | 398 view_->CreateView(base_tab_contents ? |
399 base_tab_contents->view()->GetContainerSize() : gfx::Size()); | 399 base_tab_contents->view()->GetContainerSize() : gfx::Size()); |
400 | 400 |
401 // Register for notifications about all interested prefs change. | 401 // Register for notifications about all interested prefs change. |
402 PrefService* prefs = profile->GetPrefs(); | 402 PrefService* prefs = profile->GetPrefs(); |
| 403 pref_change_registrar_.Init(prefs); |
403 if (prefs) { | 404 if (prefs) { |
404 for (int i = 0; i < kPrefsToObserveLength; ++i) | 405 for (int i = 0; i < kPrefsToObserveLength; ++i) |
405 prefs->AddPrefObserver(kPrefsToObserve[i], this); | 406 pref_change_registrar_.Add(kPrefsToObserve[i], this); |
406 } | 407 } |
407 | 408 |
408 // Register for notifications about URL starredness changing on any profile. | 409 // Register for notifications about URL starredness changing on any profile. |
409 registrar_.Add(this, NotificationType::URLS_STARRED, | 410 registrar_.Add(this, NotificationType::URLS_STARRED, |
410 NotificationService::AllSources()); | 411 NotificationService::AllSources()); |
411 registrar_.Add(this, NotificationType::BOOKMARK_MODEL_LOADED, | 412 registrar_.Add(this, NotificationType::BOOKMARK_MODEL_LOADED, |
412 NotificationService::AllSources()); | 413 NotificationService::AllSources()); |
413 registrar_.Add(this, NotificationType::RENDER_WIDGET_HOST_DESTROYED, | 414 registrar_.Add(this, NotificationType::RENDER_WIDGET_HOST_DESTROYED, |
414 NotificationService::AllSources()); | 415 NotificationService::AllSources()); |
415 #if defined(OS_LINUX) | 416 #if defined(OS_LINUX) |
(...skipping 19 matching lines...) Expand all Loading... |
435 // Set-up the showing of the omnibox search infobar if applicable. | 436 // Set-up the showing of the omnibox search infobar if applicable. |
436 if (OmniboxSearchHint::IsEnabled(profile)) | 437 if (OmniboxSearchHint::IsEnabled(profile)) |
437 omnibox_search_hint_.reset(new OmniboxSearchHint(this)); | 438 omnibox_search_hint_.reset(new OmniboxSearchHint(this)); |
438 } | 439 } |
439 | 440 |
440 TabContents::~TabContents() { | 441 TabContents::~TabContents() { |
441 is_being_destroyed_ = true; | 442 is_being_destroyed_ = true; |
442 | 443 |
443 // We don't want any notifications while we're running our destructor. | 444 // We don't want any notifications while we're running our destructor. |
444 registrar_.RemoveAll(); | 445 registrar_.RemoveAll(); |
445 | 446 pref_change_registrar_.RemoveAll(); |
446 // Unregister the notifications of all observed prefs change. | |
447 PrefService* prefs = profile()->GetPrefs(); | |
448 if (prefs) { | |
449 for (int i = 0; i < kPrefsToObserveLength; ++i) | |
450 prefs->RemovePrefObserver(kPrefsToObserve[i], this); | |
451 } | |
452 | 447 |
453 NotifyDisconnected(); | 448 NotifyDisconnected(); |
454 hung_renderer_dialog::HideForTabContents(this); | 449 hung_renderer_dialog::HideForTabContents(this); |
455 | 450 |
456 // First cleanly close all child windows. | 451 // First cleanly close all child windows. |
457 // TODO(mpcomplete): handle case if MaybeCloseChildWindows() already asked | 452 // TODO(mpcomplete): handle case if MaybeCloseChildWindows() already asked |
458 // some of these to close. CloseWindows is async, so it might get called | 453 // some of these to close. CloseWindows is async, so it might get called |
459 // twice before it runs. | 454 // twice before it runs. |
460 CloseConstrainedWindows(); | 455 CloseConstrainedWindows(); |
461 | 456 |
(...skipping 2829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3291 AddInfoBar(new SavePasswordInfoBarDelegate(this, form_to_save)); | 3286 AddInfoBar(new SavePasswordInfoBarDelegate(this, form_to_save)); |
3292 } | 3287 } |
3293 | 3288 |
3294 Profile* TabContents::GetProfileForPasswordManager() { | 3289 Profile* TabContents::GetProfileForPasswordManager() { |
3295 return profile(); | 3290 return profile(); |
3296 } | 3291 } |
3297 | 3292 |
3298 bool TabContents::DidLastPageLoadEncounterSSLErrors() { | 3293 bool TabContents::DidLastPageLoadEncounterSSLErrors() { |
3299 return controller().ssl_manager()->ProcessedSSLErrorFromRequest(); | 3294 return controller().ssl_manager()->ProcessedSSLErrorFromRequest(); |
3300 } | 3295 } |
OLD | NEW |