OLD | NEW |
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 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 } | 567 } |
568 | 568 |
569 void TabContents::SetIsCrashed(bool state) { | 569 void TabContents::SetIsCrashed(bool state) { |
570 if (state == is_crashed_) | 570 if (state == is_crashed_) |
571 return; | 571 return; |
572 | 572 |
573 is_crashed_ = state; | 573 is_crashed_ = state; |
574 NotifyNavigationStateChanged(INVALIDATE_TAB); | 574 NotifyNavigationStateChanged(INVALIDATE_TAB); |
575 } | 575 } |
576 | 576 |
577 void TabContents::SetPageActionEnabled(const PageAction* page_action, | 577 void TabContents::SetPageActionEnabled(const ContextualAction* page_action, |
578 bool enable, | 578 bool enable, |
579 const std::string& title, | 579 const std::string& title, |
580 int icon_id) { | 580 int icon_id) { |
581 DCHECK(page_action); | 581 DCHECK(page_action); |
582 | 582 |
583 if (!enable && | 583 if (!enable && |
584 enabled_page_actions_.end() == enabled_page_actions_.find(page_action)) { | 584 enabled_page_actions_.end() == enabled_page_actions_.find(page_action)) { |
585 return; // Don't need to disable twice. | 585 return; // Don't need to disable twice. |
586 } | 586 } |
587 | 587 |
588 if (enable) { | 588 if (enable) { |
589 enabled_page_actions_[page_action].reset( | 589 enabled_page_actions_[page_action].reset( |
590 new PageActionState(title, icon_id)); | 590 new ContextualActionState(title, icon_id)); |
591 } else { | 591 } else { |
592 enabled_page_actions_.erase(page_action); | 592 enabled_page_actions_.erase(page_action); |
593 } | 593 } |
594 } | 594 } |
595 | 595 |
596 const PageActionState* TabContents::GetPageActionState( | 596 const ContextualActionState* TabContents::GetPageActionState( |
597 const PageAction* page_action) { | 597 const ContextualAction* page_action) { |
598 if (enabled_page_actions_.end() == enabled_page_actions_.find(page_action)) | 598 if (enabled_page_actions_.end() == enabled_page_actions_.find(page_action)) |
599 return NULL; | 599 return NULL; |
600 | 600 |
601 return enabled_page_actions_[page_action].get(); | 601 return enabled_page_actions_[page_action].get(); |
602 } | 602 } |
603 | 603 |
604 void TabContents::NotifyNavigationStateChanged(unsigned changed_flags) { | 604 void TabContents::NotifyNavigationStateChanged(unsigned changed_flags) { |
605 if (delegate_) | 605 if (delegate_) |
606 delegate_->NavigationStateChanged(this, changed_flags); | 606 delegate_->NavigationStateChanged(this, changed_flags); |
607 } | 607 } |
(...skipping 1916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2524 | 2524 |
2525 default: | 2525 default: |
2526 NOTREACHED(); | 2526 NOTREACHED(); |
2527 } | 2527 } |
2528 } | 2528 } |
2529 | 2529 |
2530 void TabContents::set_encoding(const std::string& encoding) { | 2530 void TabContents::set_encoding(const std::string& encoding) { |
2531 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding); | 2531 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding); |
2532 } | 2532 } |
2533 | 2533 |
OLD | NEW |