summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-13 18:11:55 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-13 18:11:55 +0000
commit8ad2ac49bd0bff04d92162f5e215398eb5372cec (patch)
tree0f129107b91a02124358dd12f6d09a89d2ae7a6d /chrome/browser/views
parent0b88fdb528f015cc6c602ec098878a5e0203657b (diff)
downloadchromium_src-8ad2ac49bd0bff04d92162f5e215398eb5372cec.zip
chromium_src-8ad2ac49bd0bff04d92162f5e215398eb5372cec.tar.gz
chromium_src-8ad2ac49bd0bff04d92162f5e215398eb5372cec.tar.bz2
Make some functions const. This will help with my fullscreen mode changes.
The only tricky bit here is how GetBookmarkBarView() is no longer guaranteed to return non-NULL. The only caller of this is the automation framework, in one place, which explicitly NULL-checks the result and does the right thing, so there should not be any problems. Review URL: http://codereview.chromium.org/23026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9764 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views')
-rw-r--r--chrome/browser/views/frame/aero_glass_frame.cc4
-rw-r--r--chrome/browser/views/frame/aero_glass_frame.h1
-rw-r--r--chrome/browser/views/frame/browser_frame.h1
-rw-r--r--chrome/browser/views/frame/browser_view.cc21
-rw-r--r--chrome/browser/views/frame/browser_view.h2
-rw-r--r--chrome/browser/views/frame/opaque_frame.cc4
-rw-r--r--chrome/browser/views/frame/opaque_frame.h1
7 files changed, 22 insertions, 12 deletions
diff --git a/chrome/browser/views/frame/aero_glass_frame.cc b/chrome/browser/views/frame/aero_glass_frame.cc
index 78cda9f..c6e2017 100644
--- a/chrome/browser/views/frame/aero_glass_frame.cc
+++ b/chrome/browser/views/frame/aero_glass_frame.cc
@@ -84,6 +84,10 @@ views::Window* AeroGlassFrame::GetWindow() {
return this;
}
+const views::Window* AeroGlassFrame::GetWindow() const {
+ return this;
+}
+
///////////////////////////////////////////////////////////////////////////////
// AeroGlassFrame, views::WidgetWin overrides:
diff --git a/chrome/browser/views/frame/aero_glass_frame.h b/chrome/browser/views/frame/aero_glass_frame.h
index d6ee7be9..2541467 100644
--- a/chrome/browser/views/frame/aero_glass_frame.h
+++ b/chrome/browser/views/frame/aero_glass_frame.h
@@ -37,6 +37,7 @@ class AeroGlassFrame : public BrowserFrame,
virtual gfx::Rect GetBoundsForTabStrip(TabStrip* tabstrip) const;
virtual void UpdateThrobber(bool running);
virtual views::Window* GetWindow();
+ virtual const views::Window* GetWindow() const;
protected:
// Overridden from views::WidgetWin:
diff --git a/chrome/browser/views/frame/browser_frame.h b/chrome/browser/views/frame/browser_frame.h
index 28dd275..ee908b5 100644
--- a/chrome/browser/views/frame/browser_frame.h
+++ b/chrome/browser/views/frame/browser_frame.h
@@ -42,6 +42,7 @@ class BrowserFrame {
// Returns the views::Window associated with this frame.
virtual views::Window* GetWindow() = 0;
+ virtual const views::Window* GetWindow() const = 0;
enum FrameType {
FRAMETYPE_OPAQUE,
diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc
index 5111358..5d7059e 100644
--- a/chrome/browser/views/frame/browser_view.cc
+++ b/chrome/browser/views/frame/browser_view.cc
@@ -721,16 +721,7 @@ void BrowserView::ShowHTMLDialog(HtmlDialogContentsDelegate* delegate,
///////////////////////////////////////////////////////////////////////////////
// BrowserView, BrowserWindowTesting implementation:
-BookmarkBarView* BrowserView::GetBookmarkBarView() {
- TabContents* current_tab = browser_->GetSelectedTabContents();
- if (!bookmark_bar_view_.get()) {
- bookmark_bar_view_.reset(new BookmarkBarView(current_tab->profile(),
- browser_.get()));
- bookmark_bar_view_->SetParentOwned(false);
- } else {
- bookmark_bar_view_->SetProfile(current_tab->profile());
- }
- bookmark_bar_view_->SetPageNavigator(current_tab);
+BookmarkBarView* BrowserView::GetBookmarkBarView() const {
return bookmark_bar_view_.get();
}
@@ -1279,7 +1270,15 @@ void BrowserView::LayoutStatusBubble(int top) {
bool BrowserView::MaybeShowBookmarkBar(TabContents* contents) {
views::View* new_bookmark_bar_view = NULL;
if (SupportsWindowFeature(FEATURE_BOOKMARKBAR) && contents) {
- new_bookmark_bar_view = GetBookmarkBarView();
+ if (!bookmark_bar_view_.get()) {
+ bookmark_bar_view_.reset(new BookmarkBarView(contents->profile(),
+ browser_.get()));
+ bookmark_bar_view_->SetParentOwned(false);
+ } else {
+ bookmark_bar_view_->SetProfile(contents->profile());
+ }
+ bookmark_bar_view_->SetPageNavigator(contents);
+ new_bookmark_bar_view = bookmark_bar_view_.get();
if (!show_bookmark_bar_pref_.GetValue() &&
new_bookmark_bar_view->GetPreferredSize().height() == 0) {
new_bookmark_bar_view = NULL;
diff --git a/chrome/browser/views/frame/browser_view.h b/chrome/browser/views/frame/browser_view.h
index ba247c9..c8cce70 100644
--- a/chrome/browser/views/frame/browser_view.h
+++ b/chrome/browser/views/frame/browser_view.h
@@ -196,7 +196,7 @@ class BrowserView : public BrowserWindow,
void* parent_window);
// Overridden from BrowserWindowTesting:
- virtual BookmarkBarView* GetBookmarkBarView();
+ virtual BookmarkBarView* GetBookmarkBarView() const;
virtual LocationBarView* GetLocationBarView() const;
// Overridden from NotificationObserver:
diff --git a/chrome/browser/views/frame/opaque_frame.cc b/chrome/browser/views/frame/opaque_frame.cc
index 9a7f356..5895418 100644
--- a/chrome/browser/views/frame/opaque_frame.cc
+++ b/chrome/browser/views/frame/opaque_frame.cc
@@ -58,6 +58,10 @@ views::Window* OpaqueFrame::GetWindow() {
return this;
}
+const views::Window* OpaqueFrame::GetWindow() const {
+ return this;
+}
+
///////////////////////////////////////////////////////////////////////////////
// OpaqueFrame, views::CustomFrameWindow overrides:
diff --git a/chrome/browser/views/frame/opaque_frame.h b/chrome/browser/views/frame/opaque_frame.h
index e5d2f552..8a02595 100644
--- a/chrome/browser/views/frame/opaque_frame.h
+++ b/chrome/browser/views/frame/opaque_frame.h
@@ -39,6 +39,7 @@ class OpaqueFrame : public BrowserFrame,
virtual gfx::Rect GetBoundsForTabStrip(TabStrip* tabstrip) const;
virtual void UpdateThrobber(bool running);
virtual views::Window* GetWindow();
+ virtual const views::Window* GetWindow() const;
// Overridden from views::CustomFrameWindow:
virtual void UpdateWindowIcon();