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

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

Issue 165370: Merge 22711 - Fix a few bugs with the theme infobar:... (Closed) Base URL: svn://chrome-svn/chrome/branches/195/src/
Patch Set: Created 11 years, 4 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
Property Changes:
Modified: svn:mergeinfo
Merged /trunk/src/chrome/browser/tab_contents/tab_contents.cc:r22711
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "base/file_version_info.h" 9 #include "base/file_version_info.h"
10 #include "base/process_util.h" 10 #include "base/process_util.h"
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 infobar_delegates_.erase(it); 872 infobar_delegates_.erase(it);
873 873
874 // Remove ourselves as an observer if we are tracking no more InfoBars. 874 // Remove ourselves as an observer if we are tracking no more InfoBars.
875 if (infobar_delegates_.empty()) { 875 if (infobar_delegates_.empty()) {
876 registrar_.Remove(this, NotificationType::NAV_ENTRY_COMMITTED, 876 registrar_.Remove(this, NotificationType::NAV_ENTRY_COMMITTED,
877 Source<NavigationController>(&controller_)); 877 Source<NavigationController>(&controller_));
878 } 878 }
879 } 879 }
880 } 880 }
881 881
882 void TabContents::ReplaceInfoBar(InfoBarDelegate* old_delegate,
883 InfoBarDelegate* new_delegate) {
884 std::vector<InfoBarDelegate*>::iterator it =
885 find(infobar_delegates_.begin(), infobar_delegates_.end(), old_delegate);
886 DCHECK(it != infobar_delegates_.end());
887
888 // Notify the container about the change of plans.
889 scoped_ptr<std::pair<InfoBarDelegate*, InfoBarDelegate*> > details(
890 new std::pair<InfoBarDelegate*, InfoBarDelegate*>(
891 old_delegate, new_delegate));
892 NotificationService::current()->Notify(
893 NotificationType::TAB_CONTENTS_INFOBAR_REPLACED,
894 Source<TabContents>(this),
895 Details<std::pair<InfoBarDelegate*, InfoBarDelegate*> >(details.get()));
896
897 // Remove the old one.
898 infobar_delegates_.erase(it);
899
900 // Add the new one.
901 infobar_delegates_.push_back(new_delegate);
902 }
903
882 bool TabContents::IsBookmarkBarAlwaysVisible() { 904 bool TabContents::IsBookmarkBarAlwaysVisible() {
883 // See GetDOMUIForCurrentState() comment for more info. This case is very 905 // See GetDOMUIForCurrentState() comment for more info. This case is very
884 // similar, but for non-first loads, we want to use the committed entry. This 906 // similar, but for non-first loads, we want to use the committed entry. This
885 // is so the bookmarks bar disappears at the same time the page does. 907 // is so the bookmarks bar disappears at the same time the page does.
886 if (controller_.GetLastCommittedEntry()) { 908 if (controller_.GetLastCommittedEntry()) {
887 // Not the first load, always use the committed DOM UI. 909 // Not the first load, always use the committed DOM UI.
888 if (render_manager_.dom_ui()) 910 if (render_manager_.dom_ui())
889 return render_manager_.dom_ui()->force_bookmark_bar_visible(); 911 return render_manager_.dom_ui()->force_bookmark_bar_visible();
890 return false; // Default. 912 return false; // Default.
891 } 913 }
(...skipping 1477 matching lines...) Expand 10 before | Expand all | Expand 10 after
2369 NavigationController::LoadCommittedDetails& committed_details = 2391 NavigationController::LoadCommittedDetails& committed_details =
2370 *(Details<NavigationController::LoadCommittedDetails>(details).ptr()); 2392 *(Details<NavigationController::LoadCommittedDetails>(details).ptr());
2371 ExpireInfoBars(committed_details); 2393 ExpireInfoBars(committed_details);
2372 break; 2394 break;
2373 } 2395 }
2374 2396
2375 default: 2397 default:
2376 NOTREACHED(); 2398 NOTREACHED();
2377 } 2399 }
2378 } 2400 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/tab_contents.h ('k') | chrome/browser/views/infobars/infobar_container.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698