summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-26 21:56:56 +0000
committerxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-26 21:56:56 +0000
commitbe04582be05890d1922a16096816e8d027b67128 (patch)
tree91d208b93a14e9c3ad66e9dd472db0be4af06e80
parentfebc4ac3705e78f2d5f7b766352eb861f1a1efe1 (diff)
downloadchromium_src-be04582be05890d1922a16096816e8d027b67128.zip
chromium_src-be04582be05890d1922a16096816e8d027b67128.tar.gz
chromium_src-be04582be05890d1922a16096816e8d027b67128.tar.bz2
Make IsPopup a const function per brett.
- Make TabContentsDelegate::IsPopup a const function; - Add a default implementation for IsPopup; - Update all derived classes; - Remove the bad const_cast in tab_contents.cc; BUG=none. TEST=none. Code quality improvement and expect no changes. Review URL: http://codereview.chromium.org/3060013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53696 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/blocked_popup_container.cc2
-rw-r--r--chrome/browser/blocked_popup_container.h2
-rw-r--r--chrome/browser/browser.cc2
-rw-r--r--chrome/browser/browser.h2
-rw-r--r--chrome/browser/debugger/devtools_window.h1
-rw-r--r--chrome/browser/dom_ui/html_dialog_tab_contents_delegate.cc2
-rw-r--r--chrome/browser/dom_ui/html_dialog_tab_contents_delegate.h2
-rw-r--r--chrome/browser/external_tab_container_win.cc4
-rw-r--r--chrome/browser/external_tab_container_win.h1
-rw-r--r--chrome/browser/tab_contents/tab_contents.cc2
-rw-r--r--chrome/browser/tab_contents/tab_contents_delegate.cc4
-rw-r--r--chrome/browser/tab_contents/tab_contents_delegate.h2
-rw-r--r--chrome/browser/views/app_launcher.h1
-rw-r--r--chrome/browser/views/tabs/dragged_tab_controller.cc4
-rw-r--r--chrome/browser/views/tabs/dragged_tab_controller.h1
15 files changed, 12 insertions, 20 deletions
diff --git a/chrome/browser/blocked_popup_container.cc b/chrome/browser/blocked_popup_container.cc
index ae52604..fdf1530 100644
--- a/chrome/browser/blocked_popup_container.cc
+++ b/chrome/browser/blocked_popup_container.cc
@@ -110,7 +110,7 @@ void BlockedPopupContainer::MoveContents(TabContents* source,
}
}
-bool BlockedPopupContainer::IsPopup(TabContents* source) {
+bool BlockedPopupContainer::IsPopup(const TabContents* source) const {
return true;
}
diff --git a/chrome/browser/blocked_popup_container.h b/chrome/browser/blocked_popup_container.h
index 1cbc0f2..fa9b5fd 100644
--- a/chrome/browser/blocked_popup_container.h
+++ b/chrome/browser/blocked_popup_container.h
@@ -70,7 +70,7 @@ class BlockedPopupContainer : public TabContentsDelegate {
virtual void MoveContents(TabContents* source, const gfx::Rect& new_bounds);
// Always returns true.
- virtual bool IsPopup(TabContents* source);
+ virtual bool IsPopup(const TabContents* source) const;
// Returns our |owner_|.
virtual TabContents* GetConstrainingContents(TabContents* source);
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index fb43c99..9b91b08 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -2637,7 +2637,7 @@ void Browser::DetachContents(TabContents* source) {
tabstrip_model_.DetachTabContentsAt(index);
}
-bool Browser::IsPopup(TabContents* source) {
+bool Browser::IsPopup(const TabContents* source) const {
// A non-tabbed BROWSER is an unconstrained popup.
return !!(type() & TYPE_POPUP);
}
diff --git a/chrome/browser/browser.h b/chrome/browser/browser.h
index 6f9ab58..390f753 100644
--- a/chrome/browser/browser.h
+++ b/chrome/browser/browser.h
@@ -692,7 +692,7 @@ class Browser : public TabStripModelDelegate,
virtual void CloseContents(TabContents* source);
virtual void MoveContents(TabContents* source, const gfx::Rect& pos);
virtual void DetachContents(TabContents* source);
- virtual bool IsPopup(TabContents* source);
+ virtual bool IsPopup(const TabContents* source) const;
virtual bool CanReloadContents(TabContents* source) const;
virtual void ToolbarSizeChanged(TabContents* source, bool is_animating);
virtual void URLStarredChanged(TabContents* source, bool starred);
diff --git a/chrome/browser/debugger/devtools_window.h b/chrome/browser/debugger/devtools_window.h
index 0bdcd67..189cf5b 100644
--- a/chrome/browser/debugger/devtools_window.h
+++ b/chrome/browser/debugger/devtools_window.h
@@ -82,7 +82,6 @@ class DevToolsWindow
virtual void LoadingStateChanged(TabContents* source) {}
virtual void CloseContents(TabContents* source) {}
virtual void MoveContents(TabContents* source, const gfx::Rect& pos) {}
- virtual bool IsPopup(TabContents* source) { return false; }
virtual bool CanReloadContents(TabContents* source) const { return false; }
virtual void URLStarredChanged(TabContents* source, bool starred) {}
virtual void UpdateTargetURL(TabContents* source, const GURL& url) {}
diff --git a/chrome/browser/dom_ui/html_dialog_tab_contents_delegate.cc b/chrome/browser/dom_ui/html_dialog_tab_contents_delegate.cc
index a2ba5eb..64d6d1c 100644
--- a/chrome/browser/dom_ui/html_dialog_tab_contents_delegate.cc
+++ b/chrome/browser/dom_ui/html_dialog_tab_contents_delegate.cc
@@ -85,7 +85,7 @@ void HtmlDialogTabContentsDelegate::CloseContents(TabContents* source) {
// cleanup somewhere else (namely, HtmlDialogUIDelegate::OnDialogClosed()).
}
-bool HtmlDialogTabContentsDelegate::IsPopup(TabContents* source) {
+bool HtmlDialogTabContentsDelegate::IsPopup(const TabContents* source) const {
// This needs to return true so that we are allowed to be resized by our
// contents.
return true;
diff --git a/chrome/browser/dom_ui/html_dialog_tab_contents_delegate.h b/chrome/browser/dom_ui/html_dialog_tab_contents_delegate.h
index d827424..f9e3ac6 100644
--- a/chrome/browser/dom_ui/html_dialog_tab_contents_delegate.h
+++ b/chrome/browser/dom_ui/html_dialog_tab_contents_delegate.h
@@ -49,7 +49,7 @@ class HtmlDialogTabContentsDelegate : public TabContentsDelegate {
virtual void ActivateContents(TabContents* contents);
virtual void LoadingStateChanged(TabContents* source);
virtual void CloseContents(TabContents* source);
- virtual bool IsPopup(TabContents* source);
+ virtual bool IsPopup(const TabContents* source) const;
virtual void URLStarredChanged(TabContents* source, bool starred);
virtual void UpdateTargetURL(TabContents* source, const GURL& url);
virtual bool ShouldAddNavigationToHistory() const;
diff --git a/chrome/browser/external_tab_container_win.cc b/chrome/browser/external_tab_container_win.cc
index 3257cdc..86ccefe 100644
--- a/chrome/browser/external_tab_container_win.cc
+++ b/chrome/browser/external_tab_container_win.cc
@@ -427,10 +427,6 @@ void ExternalTabContainer::MoveContents(TabContents* source,
const gfx::Rect& pos) {
}
-bool ExternalTabContainer::IsPopup(TabContents* source) {
- return false;
-}
-
void ExternalTabContainer::URLStarredChanged(TabContents* source,
bool starred) {
}
diff --git a/chrome/browser/external_tab_container_win.h b/chrome/browser/external_tab_container_win.h
index 1d92f49..5591bd5 100644
--- a/chrome/browser/external_tab_container_win.h
+++ b/chrome/browser/external_tab_container_win.h
@@ -120,7 +120,6 @@ class ExternalTabContainer : public TabContentsDelegate,
virtual void LoadingStateChanged(TabContents* source);
virtual void CloseContents(TabContents* source);
virtual void MoveContents(TabContents* source, const gfx::Rect& pos);
- virtual bool IsPopup(TabContents* source);
virtual void URLStarredChanged(TabContents* source, bool starred);
virtual void UpdateTargetURL(TabContents* source, const GURL& url);
virtual void ContentsZoomChange(bool zoom_in);
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc
index 9395c8c..0faf4fc 100644
--- a/chrome/browser/tab_contents/tab_contents.cc
+++ b/chrome/browser/tab_contents/tab_contents.cc
@@ -1366,7 +1366,7 @@ bool TabContents::ShouldAcceptDragAndDrop() const {
#if defined(OS_CHROMEOS)
// ChromeOS panels (pop-ups) do not take drag-n-drop.
// See http://crosbug.com/2413
- return delegate() && !delegate()->IsPopup(const_cast<TabContents*>(this));
+ return delegate() && !delegate()->IsPopup(this);
#else
return true;
#endif
diff --git a/chrome/browser/tab_contents/tab_contents_delegate.cc b/chrome/browser/tab_contents/tab_contents_delegate.cc
index 8e904ca..9cf9f88 100644
--- a/chrome/browser/tab_contents/tab_contents_delegate.cc
+++ b/chrome/browser/tab_contents/tab_contents_delegate.cc
@@ -7,6 +7,10 @@
void TabContentsDelegate::DetachContents(TabContents* source) {
}
+bool TabContentsDelegate::IsPopup(const TabContents* source) const {
+ return false;
+}
+
TabContents* TabContentsDelegate::GetConstrainingContents(TabContents* source) {
return source;
}
diff --git a/chrome/browser/tab_contents/tab_contents_delegate.h b/chrome/browser/tab_contents/tab_contents_delegate.h
index fdd0964..a5976d2 100644
--- a/chrome/browser/tab_contents/tab_contents_delegate.h
+++ b/chrome/browser/tab_contents/tab_contents_delegate.h
@@ -86,7 +86,7 @@ class TabContentsDelegate : public AutomationResourceRoutingDelegate {
virtual void DetachContents(TabContents* source);
// Called to determine if the TabContents is contained in a popup window.
- virtual bool IsPopup(TabContents* source) = 0;
+ virtual bool IsPopup(const TabContents* source) const;
// If |source| is constrained, returns the tab containing it. Otherwise
// returns |source|.
diff --git a/chrome/browser/views/app_launcher.h b/chrome/browser/views/app_launcher.h
index 3a03f9e..bdfcf54 100644
--- a/chrome/browser/views/app_launcher.h
+++ b/chrome/browser/views/app_launcher.h
@@ -88,7 +88,6 @@ class AppLauncher : public AnimationDelegate,
virtual void LoadingStateChanged(TabContents* source) {}
virtual void CloseContents(TabContents* source) {}
virtual void MoveContents(TabContents* source, const gfx::Rect& pos) {}
- virtual bool IsPopup(TabContents* source) { return false; }
virtual void ToolbarSizeChanged(TabContents* source, bool is_animating) {}
virtual void URLStarredChanged(TabContents* source, bool starred) {}
virtual void UpdateTargetURL(TabContents* source, const GURL& url) {}
diff --git a/chrome/browser/views/tabs/dragged_tab_controller.cc b/chrome/browser/views/tabs/dragged_tab_controller.cc
index d6514bf..f83d863 100644
--- a/chrome/browser/views/tabs/dragged_tab_controller.cc
+++ b/chrome/browser/views/tabs/dragged_tab_controller.cc
@@ -465,10 +465,6 @@ void DraggedTabController::MoveContents(TabContents* source,
// own window. Should be ignored since we're moving the window...
}
-bool DraggedTabController::IsPopup(TabContents* source) {
- return false;
-}
-
void DraggedTabController::ToolbarSizeChanged(TabContents* source,
bool finished) {
// Dragged tabs don't care about this.
diff --git a/chrome/browser/views/tabs/dragged_tab_controller.h b/chrome/browser/views/tabs/dragged_tab_controller.h
index 66f4ced..2fe3e92 100644
--- a/chrome/browser/views/tabs/dragged_tab_controller.h
+++ b/chrome/browser/views/tabs/dragged_tab_controller.h
@@ -104,7 +104,6 @@ class DraggedTabController : public TabContentsDelegate,
virtual void LoadingStateChanged(TabContents* source);
virtual void CloseContents(TabContents* source);
virtual void MoveContents(TabContents* source, const gfx::Rect& pos);
- virtual bool IsPopup(TabContents* source);
virtual void ToolbarSizeChanged(TabContents* source, bool is_animating);
virtual void URLStarredChanged(TabContents* source, bool starred);
virtual void UpdateTargetURL(TabContents* source, const GURL& url);