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

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

Issue 7046080: When replacing an infobar, maintain the old infobar's position. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 6 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
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/ui/tab_contents/tab_contents_wrapper.h" 5 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "chrome/browser/autocomplete_history_manager.h" 9 #include "chrome/browser/autocomplete_history_manager.h"
10 #include "chrome/browser/autofill/autofill_manager.h" 10 #include "chrome/browser/autofill/autofill_manager.h"
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 DCHECK(it != infobar_delegates_.end()); 508 DCHECK(it != infobar_delegates_.end());
509 509
510 // Notify the container about the change of plans. 510 // Notify the container about the change of plans.
511 typedef std::pair<InfoBarDelegate*, InfoBarDelegate*> ReplaceDetails; 511 typedef std::pair<InfoBarDelegate*, InfoBarDelegate*> ReplaceDetails;
512 ReplaceDetails replace_details(old_delegate, new_delegate); 512 ReplaceDetails replace_details(old_delegate, new_delegate);
513 NotificationService::current()->Notify( 513 NotificationService::current()->Notify(
514 NotificationType::TAB_CONTENTS_INFOBAR_REPLACED, 514 NotificationType::TAB_CONTENTS_INFOBAR_REPLACED,
515 Source<TabContentsWrapper>(this), 515 Source<TabContentsWrapper>(this),
516 Details<ReplaceDetails>(&replace_details)); 516 Details<ReplaceDetails>(&replace_details));
517 517
518 // Remove the old one.
519 infobar_delegates_.erase(it);
520
521 // Add the new one.
522 DCHECK(find(infobar_delegates_.begin(), 518 DCHECK(find(infobar_delegates_.begin(),
523 infobar_delegates_.end(), new_delegate) == 519 infobar_delegates_.end(), new_delegate) ==
524 infobar_delegates_.end()); 520 infobar_delegates_.end());
525 infobar_delegates_.push_back(new_delegate); 521 infobar_delegates_.erase(infobar_delegates_.insert(it, new_delegate) + 1);
526 } 522 }
527 523
528 //////////////////////////////////////////////////////////////////////////////// 524 ////////////////////////////////////////////////////////////////////////////////
529 // Internal helpers 525 // Internal helpers
530 526
531 void TabContentsWrapper::OnJSOutOfMemory() { 527 void TabContentsWrapper::OnJSOutOfMemory() {
532 AddInfoBar(new SimpleAlertInfoBarDelegate(tab_contents(), 528 AddInfoBar(new SimpleAlertInfoBarDelegate(tab_contents(),
533 NULL, l10n_util::GetStringUTF16(IDS_JS_OUT_OF_MEMORY_PROMPT), true)); 529 NULL, l10n_util::GetStringUTF16(IDS_JS_OUT_OF_MEMORY_PROMPT), true));
534 } 530 }
535 531
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 void TabContentsWrapper::UpdateWebPreferences() { 586 void TabContentsWrapper::UpdateWebPreferences() {
591 RenderViewHostDelegate* rvhd = tab_contents(); 587 RenderViewHostDelegate* rvhd = tab_contents();
592 Send(new ViewMsg_UpdateWebPreferences(routing_id(), rvhd->GetWebkitPrefs())); 588 Send(new ViewMsg_UpdateWebPreferences(routing_id(), rvhd->GetWebkitPrefs()));
593 } 589 }
594 590
595 void TabContentsWrapper::UpdateRendererPreferences() { 591 void TabContentsWrapper::UpdateRendererPreferences() {
596 renderer_preferences_util::UpdateFromSystemSettings( 592 renderer_preferences_util::UpdateFromSystemSettings(
597 tab_contents()->GetMutableRendererPrefs(), profile()); 593 tab_contents()->GetMutableRendererPrefs(), profile());
598 render_view_host()->SyncRendererPrefs(); 594 render_view_host()->SyncRendererPrefs();
599 } 595 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/infobar_container.cc ('k') | chrome/browser/ui/views/infobars/infobar_container_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698