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

Unified Diff: chrome/browser/sidebar/sidebar_container.cc

Issue 6250141: Sidebar mini tabs UI (views version).... Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/sidebar/sidebar_container.h ('k') | chrome/browser/sidebar/sidebar_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sidebar/sidebar_container.cc
===================================================================
--- chrome/browser/sidebar/sidebar_container.cc (revision 74134)
+++ chrome/browser/sidebar/sidebar_container.cc (working copy)
@@ -11,6 +11,7 @@
#include "chrome/browser/tab_contents/navigation_entry.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/tab_contents/tab_contents_view.h"
+#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/common/bindings_policy.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_resource.h"
@@ -19,7 +20,7 @@
#include "googleurl/src/gurl.h"
#include "third_party/skia/include/core/SkBitmap.h"
-SidebarContainer::SidebarContainer(TabContents* tab,
+SidebarContainer::SidebarContainer(TabContentsWrapper* tab,
const std::string& content_id,
Delegate* delegate)
: tab_(tab),
@@ -41,7 +42,7 @@
}
void SidebarContainer::SidebarClosing() {
- delegate_->UpdateSidebar(this);
+ NotifyUpdate(SidebarChangedDetails::SIDEBAR_STATE_CHANGED);
}
void SidebarContainer::LoadDefaults() {
@@ -65,7 +66,7 @@
}
void SidebarContainer::Show() {
- delegate_->UpdateSidebar(this);
+ NotifyUpdate(SidebarChangedDetails::SIDEBAR_STATE_CHANGED);
}
void SidebarContainer::Expand() {
@@ -79,47 +80,79 @@
}
}
- delegate_->UpdateSidebar(this);
+ NotifyUpdate(SidebarChangedDetails::SIDEBAR_STATE_CHANGED);
sidebar_contents_->view()->SetInitialFocus();
}
void SidebarContainer::Collapse() {
- delegate_->UpdateSidebar(this);
+ NotifyUpdate(SidebarChangedDetails::SIDEBAR_STATE_CHANGED);
}
void SidebarContainer::Navigate(const GURL& url) {
- // TODO(alekseys): add a progress UI.
navigate_to_default_page_on_expand_ = false;
sidebar_contents_->controller().LoadURL(
url, GURL(), PageTransition::START_PAGE);
}
void SidebarContainer::SetBadgeText(const string16& badge_text) {
- badge_text_ = badge_text;
+ if (badge_text_ != badge_text) {
+ badge_text_ = badge_text;
+ NotifyUpdate(SidebarChangedDetails::SIDEBAR_PROPS_CHANGED);
+ }
}
void SidebarContainer::SetIcon(const SkBitmap& bitmap) {
use_default_icon_ = false;
*icon_ = bitmap;
+ NotifyUpdate(SidebarChangedDetails::SIDEBAR_PROPS_CHANGED);
}
void SidebarContainer::SetTitle(const string16& title) {
- title_ = title;
+ if (title_ != title) {
+ title_ = title;
+ NotifyUpdate(SidebarChangedDetails::SIDEBAR_PROPS_CHANGED);
+ }
}
-bool SidebarContainer::IsPopup(const TabContents* source) const {
- return false;
+// TabContentsDelegate overrides.
+void SidebarContainer::NavigationStateChanged(const TabContents* source,
+ unsigned changed_flags) {
+ if (changed_flags & TabContents::INVALIDATE_TAB)
+ NotifyUpdate(SidebarChangedDetails::SIDEBAR_PROPS_CHANGED);
+ if (changed_flags & TabContents::INVALIDATE_LOAD)
+ NotifyUpdate(SidebarChangedDetails::SIDEBAR_LOADING_STATE_CHANGED);
}
+bool SidebarContainer::PreHandleKeyboardEvent(
+ const NativeWebKeyboardEvent& event,
+ bool* is_keyboard_shortcut) {
+ return tab_->tab_contents()->delegate()->PreHandleKeyboardEvent(
+ event, is_keyboard_shortcut);
+}
+
+void SidebarContainer::HandleKeyboardEvent(
+ const NativeWebKeyboardEvent& event) {
+ return tab_->tab_contents()->delegate()->HandleKeyboardEvent(event);
+}
+
+// ImageLoadingTracker::Observer overrides.
void SidebarContainer::OnImageLoaded(SkBitmap* image,
ExtensionResource resource,
int index) {
if (image && use_default_icon_) {
*icon_ = *image;
- delegate_->UpdateSidebar(this);
+ NotifyUpdate(SidebarChangedDetails::SIDEBAR_PROPS_CHANGED);
}
}
+void SidebarContainer::NotifyUpdate(
+ SidebarChangedDetails::UpdateType update_type) {
+ SidebarChangedDetails details;
+ details.source = this;
+ details.update_type = update_type;
+ delegate_->UpdateSidebar(&details);
+}
+
const Extension* SidebarContainer::GetExtension() const {
ExtensionService* service =
sidebar_contents_->profile()->GetExtensionService();
« no previous file with comments | « chrome/browser/sidebar/sidebar_container.h ('k') | chrome/browser/sidebar/sidebar_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698