summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authormad@chromium.org <mad@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-10 19:18:15 +0000
committermad@chromium.org <mad@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-10 19:18:15 +0000
commit6d7b953ec6132658ec7f85c2976c98ecd0c852b2 (patch)
treec318e59ed09ce88dafb5fabc094a26247bf52ebd /chrome
parent08658a41d004daaf4183537fe2314eb2532881ee (diff)
downloadchromium_src-6d7b953ec6132658ec7f85c2976c98ecd0c852b2.zip
chromium_src-6d7b953ec6132658ec7f85c2976c98ecd0c852b2.tar.gz
chromium_src-6d7b953ec6132658ec7f85c2976c98ecd0c852b2.tar.bz2
Relanding of http://codereview.chromium.org/16488.
Adding proper project dependency in chrome.sln. Review URL: http://codereview.chromium.org/21188 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9493 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/browser.cc8
-rw-r--r--chrome/browser/browser.h1
-rw-r--r--chrome/browser/browser_window.h10
-rw-r--r--chrome/browser/browser_window_cocoa.h3
-rw-r--r--chrome/browser/browser_window_cocoa.mm6
-rw-r--r--chrome/browser/gtk/browser_window_gtk.cc6
-rw-r--r--chrome/browser/gtk/browser_window_gtk.h3
-rw-r--r--chrome/browser/renderer_host/render_view_host.cc21
-rw-r--r--chrome/browser/renderer_host/render_view_host.h1
-rw-r--r--chrome/browser/renderer_host/render_view_host_delegate.h15
-rw-r--r--chrome/browser/renderer_host/render_widget_host.cc7
-rw-r--r--chrome/browser/renderer_host/render_widget_host.h4
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_win.cc89
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_win.h4
-rw-r--r--chrome/browser/renderer_host/resource_message_filter.cc8
-rw-r--r--chrome/browser/renderer_host/resource_message_filter.h1
-rw-r--r--chrome/browser/tab_contents/tab_contents.h4
-rw-r--r--chrome/browser/tab_contents/tab_contents_delegate.h23
-rw-r--r--chrome/browser/tab_contents/web_contents.cc33
-rw-r--r--chrome/browser/tab_contents/web_contents.h7
-rw-r--r--chrome/browser/views/download_shelf_view.cc8
-rw-r--r--chrome/browser/views/download_shelf_view.h10
-rw-r--r--chrome/browser/views/frame/browser_view.cc115
-rw-r--r--chrome/browser/views/frame/browser_view.h5
-rwxr-xr-xchrome/chrome.sln1
-rw-r--r--chrome/chrome_kjs.sln1
-rw-r--r--chrome/common/render_messages_internal.h8
-rw-r--r--chrome/common/slide_animation.h2
-rw-r--r--chrome/common/temp_scaffolding_stubs.h4
-rw-r--r--chrome/renderer/render_widget.cc15
-rw-r--r--chrome/renderer/render_widget.h7
-rw-r--r--chrome/test/test_browser_window.h3
-rw-r--r--chrome/views/resize_corner.cc33
-rw-r--r--chrome/views/resize_corner.h28
-rw-r--r--chrome/views/views.vcproj8
35 files changed, 329 insertions, 173 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index e99b82e..26c59fd 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -1085,7 +1085,7 @@ void Browser::ExecuteCommand(int id) {
case IDC_NEW_WINDOW_PROFILE_5:
case IDC_NEW_WINDOW_PROFILE_6:
case IDC_NEW_WINDOW_PROFILE_7:
- case IDC_NEW_WINDOW_PROFILE_8:
+ case IDC_NEW_WINDOW_PROFILE_8:
NewProfileWindowByIndex(id - IDC_NEW_WINDOW_PROFILE_0); break;
#if defined(OS_WIN)
case IDC_CLOSE_WINDOW: CloseWindow(); break;
@@ -1368,7 +1368,7 @@ bool Browser::RunUnloadListenerBeforeClosing(TabContents* contents) {
if (web_contents) {
// If the WebContents is not connected yet, then there's no unload
// handler we can fire even if the WebContents has an unload listener.
- // One case where we hit this is in a tab that has an infinite loop
+ // One case where we hit this is in a tab that has an infinite loop
// before load.
if (TabHasUnloadListener(contents)) {
// If the page has unload listeners, then we tell the renderer to fire
@@ -1870,6 +1870,10 @@ void Browser::BeforeUnloadFired(TabContents* tab,
*proceed_to_fire_unload = true;
}
+gfx::Rect Browser::GetRootWindowResizerRect() const {
+ return window_->GetRootWindowResizerRect();
+}
+
void Browser::ShowHtmlDialog(HtmlDialogContentsDelegate* delegate,
void* parent_window) {
window_->ShowHTMLDialog(delegate, parent_window);
diff --git a/chrome/browser/browser.h b/chrome/browser/browser.h
index 1259829..eb08970 100644
--- a/chrome/browser/browser.h
+++ b/chrome/browser/browser.h
@@ -391,6 +391,7 @@ class Browser : public TabStripModelDelegate,
virtual void BeforeUnloadFired(TabContents* source,
bool proceed,
bool* proceed_to_fire_unload);
+ virtual gfx::Rect GetRootWindowResizerRect() const;
virtual void ShowHtmlDialog(HtmlDialogContentsDelegate* delegate,
void* parent_window);
virtual void SetFocusToLocationBar();
diff --git a/chrome/browser/browser_window.h b/chrome/browser/browser_window.h
index 1b382ae..2809d2e 100644
--- a/chrome/browser/browser_window.h
+++ b/chrome/browser/browser_window.h
@@ -83,7 +83,7 @@ class BrowserWindow {
// TODO(beng): REMOVE?
// Returns true if the frame is maximized (aka zoomed).
- virtual bool IsMaximized() = 0;
+ virtual bool IsMaximized() const = 0;
// Returns the location bar.
virtual LocationBar* GetLocationBar() const = 0;
@@ -102,6 +102,12 @@ class BrowserWindow {
// Returns whether the bookmark bar is visible or not.
virtual bool IsBookmarkBarVisible() const = 0;
+ // Returns the rect where the resize corner should be drawn by the render
+ // widget host view (on top of what the renderer returns). We return an empty
+ // rect to identify that there shouldn't be a resize corner (in the cases
+ // where we take care of it ourselves at the browser level).
+ virtual gfx::Rect GetRootWindowResizerRect() const = 0;
+
// Shows or hides the bookmark bar depending on its current visibility.
virtual void ToggleBookmarkBar() = 0;
@@ -126,7 +132,7 @@ class BrowserWindow {
// Shows the Import Bookmarks & Settings dialog box.
virtual void ShowImportDialog() = 0;
-
+
// Shows the Search Engines dialog box.
virtual void ShowSearchEnginesDialog() = 0;
diff --git a/chrome/browser/browser_window_cocoa.h b/chrome/browser/browser_window_cocoa.h
index fa7e707..e719aa1 100644
--- a/chrome/browser/browser_window_cocoa.h
+++ b/chrome/browser/browser_window_cocoa.h
@@ -34,13 +34,14 @@ class BrowserWindowCocoa : public BrowserWindow {
virtual void UpdateLoadingAnimations(bool should_animate);
virtual void SetStarredState(bool is_starred);
virtual gfx::Rect GetNormalBounds() const;
- virtual bool IsMaximized();
+ virtual bool IsMaximized() const;
virtual LocationBar* GetLocationBar() const;
virtual void UpdateStopGoState(bool is_loading);
virtual void UpdateToolbar(TabContents* contents,
bool should_restore_state);
virtual void FocusToolbar();
virtual bool IsBookmarkBarVisible() const;
+ virtual gfx::Rect GetRootWindowResizerRect() const;
virtual void ToggleBookmarkBar();
virtual void ShowAboutChromeDialog();
virtual void ShowBookmarkManager();
diff --git a/chrome/browser/browser_window_cocoa.mm b/chrome/browser/browser_window_cocoa.mm
index c541985..7f313729 100644
--- a/chrome/browser/browser_window_cocoa.mm
+++ b/chrome/browser/browser_window_cocoa.mm
@@ -83,10 +83,14 @@ gfx::Rect BrowserWindowCocoa::GetNormalBounds() const {
return bounds;
}
-bool BrowserWindowCocoa::IsMaximized() {
+bool BrowserWindowCocoa::IsMaximized() const {
return [window_ isZoomed];
}
+gfx::Rect BrowserWindowCocoa::GetRootWindowResizerRect() const {
+ return gfx::Rect();
+}
+
LocationBar* BrowserWindowCocoa::GetLocationBar() const {
return [controller_ locationBar];
}
diff --git a/chrome/browser/gtk/browser_window_gtk.cc b/chrome/browser/gtk/browser_window_gtk.cc
index 30564f7..6531616 100644
--- a/chrome/browser/gtk/browser_window_gtk.cc
+++ b/chrome/browser/gtk/browser_window_gtk.cc
@@ -147,7 +147,7 @@ gfx::Rect BrowserWindowGtk::GetNormalBounds() const {
return bounds_;
}
-bool BrowserWindowGtk::IsMaximized() {
+bool BrowserWindowGtk::IsMaximized() const {
return (state_ & GDK_WINDOW_STATE_MAXIMIZED);
}
@@ -174,6 +174,10 @@ bool BrowserWindowGtk::IsBookmarkBarVisible() const {
return false;
}
+gfx::Rect BrowserWindowGtk::GetRootWindowResizerRect() const {
+ return gfx::Rect();
+}
+
void BrowserWindowGtk::ToggleBookmarkBar() {
NOTIMPLEMENTED();
}
diff --git a/chrome/browser/gtk/browser_window_gtk.h b/chrome/browser/gtk/browser_window_gtk.h
index 96a7992..9cf6b3a 100644
--- a/chrome/browser/gtk/browser_window_gtk.h
+++ b/chrome/browser/gtk/browser_window_gtk.h
@@ -37,13 +37,14 @@ class BrowserWindowGtk : public BrowserWindow {
virtual void UpdateLoadingAnimations(bool should_animate);
virtual void SetStarredState(bool is_starred);
virtual gfx::Rect GetNormalBounds() const;
- virtual bool IsMaximized();
+ virtual bool IsMaximized() const;
virtual LocationBar* GetLocationBar() const;
virtual void UpdateStopGoState(bool is_loading);
virtual void UpdateToolbar(TabContents* contents,
bool should_restore_state);
virtual void FocusToolbar();
virtual bool IsBookmarkBarVisible() const;
+ virtual gfx::Rect GetRootWindowResizerRect() const;
virtual void ToggleBookmarkBar();
virtual void ShowAboutChromeDialog();
virtual void ShowBookmarkManager();
diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc
index b78c4c9..7f4a8a3 100644
--- a/chrome/browser/renderer_host/render_view_host.cc
+++ b/chrome/browser/renderer_host/render_view_host.cc
@@ -153,7 +153,8 @@ bool RenderViewHost::CreateRenderView() {
SYNCHRONIZE,
FALSE,
0);
- DCHECK(result) << "Couldn't duplicate the modal dialog handle for the renderer.";
+ DCHECK(result) <<
+ "Couldn't duplicate the modal dialog handle for the renderer.";
#endif
DCHECK(view());
@@ -311,7 +312,7 @@ void RenderViewHost::ClosePage(int new_render_process_host_id,
}
}
-void RenderViewHost::SetHasPendingCrossSiteRequest(bool has_pending_request,
+void RenderViewHost::SetHasPendingCrossSiteRequest(bool has_pending_request,
int request_id) {
Singleton<CrossSiteRequestManager>()->SetHasPendingCrossSiteRequest(
process()->host_id(), routing_id(), has_pending_request);
@@ -385,7 +386,8 @@ void RenderViewHost::DragTargetDragEnter(const WebDropData& drop_data,
// Grant the renderer the ability to load the drop_data.
RendererSecurityPolicy* policy = RendererSecurityPolicy::GetInstance();
policy->GrantRequestURL(process()->host_id(), drop_data.url);
- for (std::vector<std::wstring>::const_iterator iter(drop_data.filenames.begin());
+ for (std::vector<std::wstring>::const_iterator
+ iter(drop_data.filenames.begin());
iter != drop_data.filenames.end(); ++iter) {
policy->GrantRequestURL(process()->host_id(),
net::FilePathToFileURL(*iter));
@@ -518,7 +520,8 @@ void RenderViewHost::JavaScriptMessageBoxClosed(IPC::Message* reply_msg,
if (--modal_dialog_count_ == 0)
modal_dialog_event_->Reset();
- ViewHostMsg_RunJavaScriptMessage::WriteReplyParams(reply_msg, success, prompt);
+ ViewHostMsg_RunJavaScriptMessage::WriteReplyParams(reply_msg,
+ success, prompt);
Send(reply_msg);
}
@@ -575,7 +578,8 @@ void RenderViewHost::AllowDomAutomationBindings() {
void RenderViewHost::AllowDOMUIBindings() {
DCHECK(!renderer_initialized_);
enable_dom_ui_bindings_ = true;
- RendererSecurityPolicy::GetInstance()->GrantDOMUIBindings(process()->host_id());
+ RendererSecurityPolicy::GetInstance()->GrantDOMUIBindings(
+ process()->host_id());
}
void RenderViewHost::AllowExternalHostBindings() {
@@ -939,7 +943,8 @@ void RenderViewHost::OnMsgDidStartProvisionalLoadForFrame(bool is_main_frame,
FilterURL(RendererSecurityPolicy::GetInstance(),
process()->host_id(), &validated_url);
- delegate_->DidStartProvisionalLoadForFrame(this, is_main_frame, validated_url);
+ delegate_->DidStartProvisionalLoadForFrame(this, is_main_frame,
+ validated_url);
}
void RenderViewHost::OnMsgDidFailProvisionalLoadWithError(
@@ -1276,6 +1281,10 @@ void RenderViewHost::NotifyRendererResponsive() {
delegate_->RendererResponsive(this);
}
+gfx::Rect RenderViewHost::GetRootWindowResizerRect() const {
+ return delegate_->GetRootWindowResizerRect();
+}
+
void RenderViewHost::OnDebugDisconnect() {
if (debugger_attached_) {
debugger_attached_ = false;
diff --git a/chrome/browser/renderer_host/render_view_host.h b/chrome/browser/renderer_host/render_view_host.h
index 2cd9d29..9d0bb37 100644
--- a/chrome/browser/renderer_host/render_view_host.h
+++ b/chrome/browser/renderer_host/render_view_host.h
@@ -410,6 +410,7 @@ class RenderViewHost : public RenderWidgetHost {
virtual bool IsRenderView() { return true; }
virtual void OnMessageReceived(const IPC::Message& msg);
virtual bool CanBlur() const;
+ virtual gfx::Rect GetRootWindowResizerRect() const;
protected:
// RenderWidgetHost protected overrides.
diff --git a/chrome/browser/renderer_host/render_view_host_delegate.h b/chrome/browser/renderer_host/render_view_host_delegate.h
index f048dc2..b701b21 100644
--- a/chrome/browser/renderer_host/render_view_host_delegate.h
+++ b/chrome/browser/renderer_host/render_view_host_delegate.h
@@ -10,6 +10,7 @@
#include "base/basictypes.h"
#include "base/file_path.h"
+#include "base/gfx/rect.h"
#include "base/logging.h"
#include "net/base/load_states.h"
#include "webkit/glue/password_form.h"
@@ -38,10 +39,6 @@ namespace IPC {
class Message;
}
-namespace gfx {
-class Rect;
-}
-
namespace webkit_glue {
struct WebApplicationInfo;
}
@@ -301,13 +298,13 @@ class RenderViewHostDelegate {
// Forms fillable by autofill have been detected in the page.
virtual void AutofillFormSubmitted(const AutofillForm& form) { }
- // Called to retrieve a list of suggestions from the web database given
+ // Called to retrieve a list of suggestions from the web database given
// the name of the field |field_name| and what the user has already typed in
// the field |user_text|. Appeals to the database thead to perform the query.
// When the database thread is finished, the autofill manager retrieves the
// calling RenderViewHost and then passes the vector of suggestions to
// RenderViewHost::AutofillSuggestionsReturned.
- virtual void GetAutofillSuggestions(const std::wstring& field_name,
+ virtual void GetAutofillSuggestions(const std::wstring& field_name,
const std::wstring& user_text,
int64 node_id,
int request_id) { }
@@ -372,9 +369,13 @@ class RenderViewHostDelegate {
// blurred.
virtual bool CanBlur() const { return true; }
+ // Return the rect where to display the resize corner, if any, otherwise
+ // an empty rect.
+ virtual gfx::Rect GetRootWindowResizerRect() const { return gfx::Rect(); }
+
// Notification that the renderer has become unresponsive. The
// delegate can use this notification to show a warning to the user.
- virtual void RendererUnresponsive(RenderViewHost* render_view_host,
+ virtual void RendererUnresponsive(RenderViewHost* render_view_host,
bool is_during_unload) { }
// Notification that a previously unresponsive renderer has become
diff --git a/chrome/browser/renderer_host/render_widget_host.cc b/chrome/browser/renderer_host/render_widget_host.cc
index a6d289b..e196a00 100644
--- a/chrome/browser/renderer_host/render_widget_host.cc
+++ b/chrome/browser/renderer_host/render_widget_host.cc
@@ -164,7 +164,8 @@ void RenderWidgetHost::WasResized() {
if (!new_size.IsEmpty())
resize_ack_pending_ = true;
- if (!Send(new ViewMsg_Resize(routing_id_, new_size)))
+ if (!Send(new ViewMsg_Resize(routing_id_, new_size,
+ GetRootWindowResizerRect())))
resize_ack_pending_ = false;
}
@@ -330,6 +331,10 @@ void RenderWidgetHost::RendererExited() {
BackingStoreManager::RemoveBackingStore(this);
}
+gfx::Rect RenderWidgetHost::GetRootWindowResizerRect() const {
+ return gfx::Rect();
+}
+
void RenderWidgetHost::Destroy() {
NotificationService::current()->Notify(
NotificationType::RENDER_WIDGET_HOST_DESTROYED,
diff --git a/chrome/browser/renderer_host/render_widget_host.h b/chrome/browser/renderer_host/render_widget_host.h
index 4bd1849..48fc912 100644
--- a/chrome/browser/renderer_host/render_widget_host.h
+++ b/chrome/browser/renderer_host/render_widget_host.h
@@ -205,6 +205,10 @@ class RenderWidgetHost : public IPC::Channel::Listener {
void ForwardKeyboardEvent(const WebKeyboardEvent& key_event);
void ForwardInputEvent(const WebInputEvent& input_event, int event_size);
+ // This is for derived classes to give us access to the resizer rect.
+ // And to also expose it to the RenderWidgetHostView.
+ virtual gfx::Rect GetRootWindowResizerRect() const;
+
protected:
// Called when we receive a notification indicating that the renderer
// process has gone. This will reset our state so that our state will be
diff --git a/chrome/browser/renderer_host/render_widget_host_view_win.cc b/chrome/browser/renderer_host/render_widget_host_view_win.cc
index b499669..65a3921 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_win.cc
+++ b/chrome/browser/renderer_host/render_widget_host_view_win.cc
@@ -20,12 +20,15 @@
#include "chrome/common/l10n_util.h"
#include "chrome/common/plugin_messages.h"
#include "chrome/common/render_messages.h"
+#include "chrome/common/resource_bundle.h"
#include "chrome/common/win_util.h"
// Included for views::kReflectedMessage - TODO(beng): move this to win_util.h!
#include "chrome/views/widget_win.h"
#include "webkit/glue/plugins/plugin_constants_win.h"
#include "webkit/glue/plugins/webplugin_delegate_impl.h"
#include "webkit/glue/webcursor.h"
+#include "webkit_resources.h"
+
using base::TimeDelta;
using base::TimeTicks;
@@ -243,28 +246,40 @@ void RenderWidgetHostViewWin::UpdateCursor(const WebCursor& cursor) {
}
void RenderWidgetHostViewWin::UpdateCursorIfOverSelf() {
+ static HCURSOR kCursorResizeRight = LoadCursor(NULL, IDC_SIZENWSE);
+ static HCURSOR kCursorResizeLeft = LoadCursor(NULL, IDC_SIZENESW);
static HCURSOR kCursorArrow = LoadCursor(NULL, IDC_ARROW);
static HCURSOR kCursorAppStarting = LoadCursor(NULL, IDC_APPSTARTING);
static HINSTANCE module_handle =
GetModuleHandle(chrome::kBrowserResourcesDll);
- // We cannot pass in NULL as the module handle as this would only work for
- // standard win32 cursors. We can also receive cursor types which are defined
- // as webkit resources. We need to specify the module handle of chrome.dll
- // while loading these cursors.
- HCURSOR display_cursor = current_cursor_.GetCursor(module_handle);
-
- // If a page is in the loading state, we want to show the Arrow+Hourglass
- // cursor only when the current cursor is the ARROW cursor. In all other
- // cases we should continue to display the current cursor.
- if (is_loading_ && display_cursor == kCursorArrow)
- display_cursor = kCursorAppStarting;
-
// If the mouse is over our HWND, then update the cursor state immediately.
CPoint pt;
GetCursorPos(&pt);
- if (WindowFromPoint(pt) == m_hWnd)
- SetCursor(display_cursor);
+ if (WindowFromPoint(pt) == m_hWnd) {
+ BOOL result = ::ScreenToClient(m_hWnd, &pt);
+ DCHECK(result);
+ if (render_widget_host_->GetRootWindowResizerRect().Contains(pt.x, pt.y)) {
+ if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT)
+ SetCursor(kCursorResizeLeft);
+ else
+ SetCursor(kCursorResizeRight);
+ } else {
+ // We cannot pass in NULL as the module handle as this would only work for
+ // standard win32 cursors. We can also receive cursor types which are
+ // defined as webkit resources. We need to specify the module handle of
+ // chrome.dll while loading these cursors.
+ HCURSOR display_cursor = current_cursor_.GetCursor(module_handle);
+
+ // If a page is in the loading state, we want to show the Arrow+Hourglass
+ // cursor only when the current cursor is the ARROW cursor. In all other
+ // cases we should continue to display the current cursor.
+ if (is_loading_ && display_cursor == kCursorArrow)
+ display_cursor = kCursorAppStarting;
+
+ SetCursor(display_cursor);
+ }
+ }
}
void RenderWidgetHostViewWin::SetIsLoading(bool is_loading) {
@@ -322,6 +337,37 @@ void RenderWidgetHostViewWin::Redraw(const gfx::Rect& rect) {
EnumChildWindows(m_hWnd, EnumChildProc, lparam);
}
+void RenderWidgetHostViewWin::DrawResizeCorner(const gfx::Rect& paint_rect,
+ HDC dc) {
+ gfx::Rect resize_corner_rect =
+ render_widget_host_->GetRootWindowResizerRect();
+ if (!paint_rect.Intersect(resize_corner_rect).IsEmpty()) {
+ SkBitmap* bitmap = ResourceBundle::GetSharedInstance().
+ GetBitmapNamed(IDR_TEXTAREA_RESIZER);
+ ChromeCanvas canvas(bitmap->width(), bitmap->height(), false);
+ // TODO(jcampan): This const_cast should not be necessary once the
+ // SKIA API has been changed to return a non-const bitmap.
+ const_cast<SkBitmap&>(canvas.getDevice()->accessBitmap(true)).
+ eraseARGB(0, 0, 0, 0);
+ int x = resize_corner_rect.x() + resize_corner_rect.width() -
+ bitmap->width();
+ bool rtl_dir = (l10n_util::GetTextDirection() ==
+ l10n_util::RIGHT_TO_LEFT);
+ if (rtl_dir) {
+ canvas.TranslateInt(bitmap->width(), 0);
+ canvas.ScaleInt(-1, 1);
+ canvas.save();
+ x = 0;
+ }
+ canvas.DrawBitmapInt(*bitmap, 0, 0);
+ canvas.getTopPlatformDevice().drawToHDC(dc, x,
+ resize_corner_rect.y() + resize_corner_rect.height() -
+ bitmap->height(), NULL);
+ if (rtl_dir)
+ canvas.restore();
+ }
+}
+
void RenderWidgetHostViewWin::DidPaintRect(const gfx::Rect& rect) {
if (is_hidden_)
return;
@@ -434,6 +480,7 @@ void RenderWidgetHostViewWin::OnPaint(HDC dc) {
gfx::Rect paint_rect = bitmap_rect.Intersect(damaged_rect);
if (!paint_rect.IsEmpty()) {
+ DrawResizeCorner(paint_rect, backing_store->hdc());
BitBlt(paint_dc.m_hDC,
paint_rect.x(),
paint_rect.y(),
@@ -722,6 +769,20 @@ LRESULT RenderWidgetHostViewWin::OnMouseEvent(UINT message, WPARAM wparam,
// call). So the WebContents window would have to be specified to the
// RenderViewHostHWND as there is no way to retrieve it from the HWND.
if (!close_on_deactivate_) { // Don't forward if the container is a popup.
+ if (message == WM_LBUTTONDOWN) {
+ // If we get clicked on, where the resize corner is drawn, we delegate the
+ // message to the root window, with the proper HTBOTTOMXXX wparam so that
+ // Windows can take care of the resizing for us.
+ if (render_widget_host_->GetRootWindowResizerRect().
+ Contains(GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam))) {
+ WPARAM wparam = HTBOTTOMRIGHT;
+ if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT)
+ wparam = HTBOTTOMLEFT;
+ HWND root_hwnd = ::GetAncestor(m_hWnd, GA_ROOT);
+ if (SendMessage(root_hwnd, WM_NCLBUTTONDOWN, wparam, lparam) == 0)
+ return 0;
+ }
+ }
switch (message) {
case WM_LBUTTONDOWN:
case WM_MBUTTONDOWN:
diff --git a/chrome/browser/renderer_host/render_widget_host_view_win.h b/chrome/browser/renderer_host/render_widget_host_view_win.h
index ec1547a..167f529 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_win.h
+++ b/chrome/browser/renderer_host/render_widget_host_view_win.h
@@ -213,6 +213,10 @@ class RenderWidgetHostViewWin :
// asynchronously.
void Redraw(const gfx::Rect& invalid_rect);
+ // Draw the resize corner bitmap on top of the given HDC, if it intersects the
+ // given paint rect.
+ void DrawResizeCorner(const gfx::Rect& paint_rect, HDC dc);
+
// The associated Model.
RenderWidgetHost* render_widget_host_;
diff --git a/chrome/browser/renderer_host/resource_message_filter.cc b/chrome/browser/renderer_host/resource_message_filter.cc
index 2db7124..51c4875 100644
--- a/chrome/browser/renderer_host/resource_message_filter.cc
+++ b/chrome/browser/renderer_host/resource_message_filter.cc
@@ -205,8 +205,6 @@ bool ResourceMessageFilter::OnMessageReceived(const IPC::Message& message) {
#if defined(OS_WIN)
IPC_MESSAGE_HANDLER(ViewHostMsg_GetWindowRect, OnGetWindowRect)
IPC_MESSAGE_HANDLER(ViewHostMsg_GetRootWindowRect, OnGetRootWindowRect)
- IPC_MESSAGE_HANDLER(ViewHostMsg_GetRootWindowResizerRect,
- OnGetRootWindowResizerRect)
#endif
IPC_MESSAGE_HANDLER(ViewHostMsg_GetMimeTypeFromExtension,
OnGetMimeTypeFromExtension)
@@ -541,12 +539,6 @@ void ResourceMessageFilter::OnGetRootWindowRect(gfx::NativeViewId window_id,
*rect = window_rect;
}
-void ResourceMessageFilter::OnGetRootWindowResizerRect(gfx::NativeViewId window,
- gfx::Rect* rect) {
- RECT window_rect = {0};
- *rect = window_rect;
-}
-
#endif // OS_WIN
void ResourceMessageFilter::OnGetMimeTypeFromExtension(
diff --git a/chrome/browser/renderer_host/resource_message_filter.h b/chrome/browser/renderer_host/resource_message_filter.h
index c4d75e3..7bb8090 100644
--- a/chrome/browser/renderer_host/resource_message_filter.h
+++ b/chrome/browser/renderer_host/resource_message_filter.h
@@ -150,7 +150,6 @@ class ResourceMessageFilter : public IPC::ChannelProxy::MessageFilter,
#if defined(OS_WIN)
void OnGetWindowRect(gfx::NativeViewId window, gfx::Rect *rect);
void OnGetRootWindowRect(gfx::NativeViewId window, gfx::Rect *rect);
- void OnGetRootWindowResizerRect(gfx::NativeViewId window, gfx::Rect *rect);
#endif
void OnGetMimeTypeFromExtension(const std::wstring& ext,
std::string* mime_type);
diff --git a/chrome/browser/tab_contents/tab_contents.h b/chrome/browser/tab_contents/tab_contents.h
index e3cb28d..b23c8d5 100644
--- a/chrome/browser/tab_contents/tab_contents.h
+++ b/chrome/browser/tab_contents/tab_contents.h
@@ -399,7 +399,7 @@ class TabContents : public PageNavigator,
// Removes the InfoBar for the specified |delegate|.
void RemoveInfoBar(InfoBarDelegate* delegate);
-
+
// Enumeration and access functions.
int infobar_delegate_count() const { return infobar_delegates_.size(); }
InfoBarDelegate* GetInfoBarDelegateAt(int index) {
@@ -407,7 +407,7 @@ class TabContents : public PageNavigator,
}
// Toolbars and such ---------------------------------------------------------
-
+
// Returns whether the bookmark bar should be visible.
virtual bool IsBookmarkBarAlwaysVisible() { return false; }
diff --git a/chrome/browser/tab_contents/tab_contents_delegate.h b/chrome/browser/tab_contents/tab_contents_delegate.h
index 428f98e..05f5e79 100644
--- a/chrome/browser/tab_contents/tab_contents_delegate.h
+++ b/chrome/browser/tab_contents/tab_contents_delegate.h
@@ -6,14 +6,10 @@
#define CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_DELEGATE_H_
#include "base/basictypes.h"
+#include "base/gfx/rect.h"
#include "chrome/browser/tab_contents/page_navigator.h"
#include "chrome/common/navigation_types.h"
-namespace gfx {
-class Point;
-class Rect;
-}
-
class TabContents;
class HtmlDialogContentsDelegate;
@@ -30,8 +26,7 @@ class TabContentsDelegate : public PageNavigator {
virtual void OpenURL(const GURL& url, const GURL& referrer,
WindowOpenDisposition disposition,
- PageTransition::Type transition)
- {
+ PageTransition::Type transition) {
OpenURLFromTab(NULL, url, referrer, disposition, transition);
}
@@ -106,7 +101,7 @@ class TabContentsDelegate : public PageNavigator {
// a WebContents with a valid WebApp set.
virtual void ConvertContentsToApplication(TabContents* source) { }
- // Informs the TabContentsDelegate that some of our state has changed
+ // Informs the TabContentsDelegate that some of our state has changed
// for this tab.
virtual void ContentsStateChanged(TabContents* source) {}
@@ -119,6 +114,10 @@ class TabContentsDelegate : public PageNavigator {
// call. ConstrainedWindows shouldn't be able to be blurred.
virtual bool CanBlur() const { return true; }
+ // Return the rect where to display the resize corner, if any, otherwise
+ // an empty rect.
+ virtual gfx::Rect GetRootWindowResizerRect() const { return gfx::Rect(); }
+
// Show a dialog with HTML content. |delegate| contains a pointer to the
// delegate who knows how to display the dialog (which file URL and JSON
// string input to use during initialization). |parent_window| is the window
@@ -129,17 +128,17 @@ class TabContentsDelegate : public PageNavigator {
// Tells us that we've finished firing this tab's beforeunload event.
// The proceed bool tells us whether the user chose to proceed closing the
// tab. Returns true if the tab can continue on firing it's unload event.
- // If we're closing the entire browser, then we'll want to delay firing
+ // If we're closing the entire browser, then we'll want to delay firing
// unload events until all the beforeunload events have fired.
virtual void BeforeUnloadFired(TabContents* tab,
- bool proceed,
- bool* proceed_to_fire_unload) {
+ bool proceed,
+ bool* proceed_to_fire_unload) {
*proceed_to_fire_unload = true;
}
// Send IPC to external host. Default implementation is do nothing.
virtual void ForwardMessageToExternalHost(const std::string& receiver,
- const std::string& message) {};
+ const std::string& message) {}
// If the delegate is hosting tabs externally.
virtual bool IsExternalTabContainer() const { return false; }
diff --git a/chrome/browser/tab_contents/web_contents.cc b/chrome/browser/tab_contents/web_contents.cc
index ec55a6c..44ab59b 100644
--- a/chrome/browser/tab_contents/web_contents.cc
+++ b/chrome/browser/tab_contents/web_contents.cc
@@ -394,7 +394,7 @@ bool WebContents::NavigateToPendingEntry(bool reload) {
}
// Clear any provisional password saves - this stops password infobars
- // showing up on pages the user navigates to while the right page is
+ // showing up on pages the user navigates to while the right page is
// loading.
GetPasswordManager()->ClearProvisionalSave();
@@ -422,7 +422,7 @@ void WebContents::Copy() {
}
void WebContents::Paste() {
- render_view_host()->Paste();
+ render_view_host()->Paste();
}
void WebContents::DisassociateFromPopupCount() {
@@ -603,7 +603,7 @@ bool WebContents::IsActiveEntry(int32 page_id) {
}
void WebContents::SetInitialFocus(bool reverse) {
- render_view_host()->SetInitialFocus(reverse);
+ render_view_host()->SetInitialFocus(reverse);
}
// Notifies the RenderWidgetHost instance about the fact that the page is
@@ -670,20 +670,20 @@ void WebContents::DidNavigate(RenderViewHost* rvh,
// We can't do anything about navigations when we're inactive.
if (!controller() || !is_active())
- return;
+ return;
// Update the site of the SiteInstance if it doesn't have one yet.
if (!GetSiteInstance()->has_site())
GetSiteInstance()->SetSite(params.url);
- // Need to update MIME type here because it's referred to in
+ // Need to update MIME type here because it's referred to in
// UpdateNavigationCommands() called by RendererDidNavigate() to
- // determine whether or not to enable the encoding menu.
- // It's updated only for the main frame. For a subframe,
+ // determine whether or not to enable the encoding menu.
+ // It's updated only for the main frame. For a subframe,
// RenderView::UpdateURL does not set params.contents_mime_type.
// (see http://code.google.com/p/chromium/issues/detail?id=2929 )
- // TODO(jungshik): Add a test for the encoding menu to avoid
- // regressing it again.
+ // TODO(jungshik): Add a test for the encoding menu to avoid
+ // regressing it again.
if (PageTransition::IsMainFrame(params.transition))
contents_mime_type_ = params.contents_mime_type;
@@ -1049,7 +1049,7 @@ void WebContents::AutofillFormSubmitted(
GetAutofillManager()->AutofillFormSubmitted(form);
}
-void WebContents::GetAutofillSuggestions(const std::wstring& field_name,
+void WebContents::GetAutofillSuggestions(const std::wstring& field_name,
const std::wstring& user_text, int64 node_id, int request_id) {
GetAutofillManager()->FetchValuesForName(field_name, user_text,
kMaxAutofillMenuItems, node_id, request_id);
@@ -1278,16 +1278,21 @@ bool WebContents::CanBlur() const {
return delegate() ? delegate()->CanBlur() : true;
}
-void WebContents::RendererUnresponsive(RenderViewHost* rvh,
+gfx::Rect WebContents::GetRootWindowResizerRect() const {
+ if (delegate())
+ return delegate()->GetRootWindowResizerRect();
+ return gfx::Rect();
+}
+
+void WebContents::RendererUnresponsive(RenderViewHost* rvh,
bool is_during_unload) {
if (is_during_unload) {
// Hang occurred while firing the beforeunload/unload handler.
// Pretend the handler fired so tab closing continues as if it had.
rvh->UnloadListenerHasFired();
- if (!render_manager_.ShouldCloseTabOnUnresponsiveRenderer()) {
+ if (!render_manager_.ShouldCloseTabOnUnresponsiveRenderer())
return;
- }
// If the tab hangs in the beforeunload/unload handler there's really
// nothing we can do to recover. Pretend the unload listeners have
@@ -1652,7 +1657,7 @@ bool WebContents::UpdateTitleForEntry(NavigationEntry* entry,
profile()->GetHistoryService(Profile::IMPLICIT_ACCESS);
if (hs)
hs->SetPageTitle(entry->display_url(), final_title);
-
+
// Don't allow the title to be saved again for explicitly set ones.
received_page_title_ = explicit_set;
}
diff --git a/chrome/browser/tab_contents/web_contents.h b/chrome/browser/tab_contents/web_contents.h
index 3326cb1..2f3044b 100644
--- a/chrome/browser/tab_contents/web_contents.h
+++ b/chrome/browser/tab_contents/web_contents.h
@@ -214,7 +214,7 @@ class WebContents : public TabContents,
// Override the encoding and reload the page by sending down
// ViewMsg_SetPageEncoding to the renderer. |UpdateEncoding| is kinda
- // the opposite of this, by which 'browser' is notified of
+ // the opposite of this, by which 'browser' is notified of
// the encoding of the current tab from 'renderer' (determined by
// auto-detect, http header, meta, bom detection, etc).
void override_encoding(const std::wstring& encoding) {
@@ -308,7 +308,7 @@ class WebContents : public TabContents,
IPC::Message* reply_msg);
virtual void PasswordFormsSeen(const std::vector<PasswordForm>& forms);
virtual void AutofillFormSubmitted(const AutofillForm& form);
- virtual void GetAutofillSuggestions(const std::wstring& field_name,
+ virtual void GetAutofillSuggestions(const std::wstring& field_name,
const std::wstring& user_text, int64 node_id, int request_id);
virtual void PageHasOSDD(RenderViewHost* render_view_host,
int32 page_id, const GURL& url, bool autodetected);
@@ -332,7 +332,8 @@ class WebContents : public TabContents,
new_request_id);
}
virtual bool CanBlur() const;
- virtual void RendererUnresponsive(RenderViewHost* render_view_host,
+ virtual gfx::Rect GetRootWindowResizerRect() const;
+ virtual void RendererUnresponsive(RenderViewHost* render_view_host,
bool is_during_unload);
virtual void RendererResponsive(RenderViewHost* render_view_host);
virtual void LoadStateChanged(const GURL& url, net::LoadState load_state);
diff --git a/chrome/browser/views/download_shelf_view.cc b/chrome/browser/views/download_shelf_view.cc
index 5467be7..d4e02ed 100644
--- a/chrome/browser/views/download_shelf_view.cc
+++ b/chrome/browser/views/download_shelf_view.cc
@@ -73,7 +73,7 @@ int CenterPosition(int size, int target_size) {
return std::max((target_size - size) / 2, kTopBottomPadding);
}
-} // namespace
+} // namespace
DownloadShelfView::DownloadShelfView(TabContents* tab_contents)
: tab_contents_(tab_contents) {
@@ -207,6 +207,9 @@ void DownloadShelfView::Layout() {
if (!GetWidget())
return;
+ // Let our base class layout our child views
+ views::View::Layout();
+
gfx::Size image_size = arrow_image_->GetPreferredSize();
gfx::Size close_button_size = close_button_->GetPreferredSize();
gfx::Size show_all_size = show_all_view_->GetPreferredSize();
@@ -270,3 +273,6 @@ void DownloadShelfView::ButtonPressed(views::BaseButton* button) {
shelf_animation_->Hide();
}
+bool DownloadShelfView::IsShowing() const {
+ return shelf_animation_->IsShowing();
+}
diff --git a/chrome/browser/views/download_shelf_view.h b/chrome/browser/views/download_shelf_view.h
index 35213a8..3f157a4 100644
--- a/chrome/browser/views/download_shelf_view.h
+++ b/chrome/browser/views/download_shelf_view.h
@@ -31,7 +31,7 @@ class DownloadShelfView : public views::View,
public views::LinkController,
public AnimationDelegate {
public:
- DownloadShelfView(TabContents* tab_contents);
+ explicit DownloadShelfView(TabContents* tab_contents);
// A new download has started, so add it to our shelf.
void AddDownload(DownloadItem* download);
@@ -68,6 +68,12 @@ class DownloadShelfView : public views::View,
// one.
void ChangeTabContents(TabContents* old_contents, TabContents* new_contents);
+ // The browser view needs to know when we are going away to properly return
+ // the resize corner size to WebKit so that we don't draw on top of it.
+ // This returns the showing state of our animation which is set to false at
+ // the beginning Show and true at the beginning of a Hide.
+ bool IsShowing() const;
+
private:
void Init();
@@ -107,5 +113,5 @@ class DownloadShelfView : public views::View,
DISALLOW_EVIL_CONSTRUCTORS(DownloadShelfView);
};
-#endif // CHROME_BROWSER_VIEWS_DOWNLOAD_SHELF_VIEW_H__
+#endif // CHROME_BROWSER_VIEWS_DOWNLOAD_SHELF_VIEW_H__
diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc
index e57b2cc..8ccb3e5 100644
--- a/chrome/browser/views/frame/browser_view.cc
+++ b/chrome/browser/views/frame/browser_view.cc
@@ -47,12 +47,15 @@
#include "chrome/common/resource_bundle.h"
#include "chrome/common/win_util.h"
#include "chrome/views/hwnd_notification_source.h"
+#include "chrome/views/native_scroll_bar.h"
#include "chrome/views/non_client_view.h"
#include "chrome/views/view.h"
#include "chrome/views/window.h"
#include "chromium_strings.h"
#include "generated_resources.h"
+#include "webkit_resources.h"
+
using base::TimeDelta;
@@ -86,7 +89,11 @@ static const int kLoadingAnimationFrameTimeMs = 30;
// If not -1, windows are shown with this state.
static int explicit_show_state = -1;
-static const struct { bool separator; int command; int label; } kMenuLayout[] = {
+static const struct {
+ bool separator;
+ int command;
+ int label;
+} kMenuLayout[] = {
{ true, 0, 0 },
{ false, IDC_TASK_MANAGER, IDS_TASK_MANAGER },
{ true, 0, 0 },
@@ -111,6 +118,53 @@ static const struct { bool separator; int command; int label; } kMenuLayout[] =
};
///////////////////////////////////////////////////////////////////////////////
+// ResizeCorner, private:
+
+class ResizeCorner : public views::View {
+ public:
+ ResizeCorner() {}
+ virtual void Paint(ChromeCanvas* canvas) {
+ SkBitmap * bitmap = ResourceBundle::GetSharedInstance().GetBitmapNamed(
+ IDR_TEXTAREA_RESIZER);
+ bitmap->buildMipMap(false);
+ bool rtl_dir = (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT);
+ if (rtl_dir) {
+ canvas->TranslateInt(width(), 0);
+ canvas->ScaleInt(-1, 1);
+ canvas->save();
+ }
+ canvas->DrawBitmapInt(*bitmap, width() - bitmap->width(),
+ height() - bitmap->height());
+ if (rtl_dir)
+ canvas->restore();
+ }
+
+ static gfx::Size GetSize() {
+ return gfx::Size(views::NativeScrollBar::GetVerticalScrollBarWidth(),
+ views::NativeScrollBar::GetHorizontalScrollBarHeight());
+ }
+
+ virtual gfx::Size GetPreferredSize() {
+ return GetSize();
+ }
+
+ virtual void Layout() {
+ views::View* parent_view = GetParent();
+ if (parent_view) {
+ gfx::Size ps = GetPreferredSize();
+ // No need to handle Right to left text direction here,
+ // our parent must take care of it for us...
+ SetBounds(parent_view->width() - ps.width(),
+ parent_view->height() - ps.height(), ps.width(), ps.height());
+ }
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ResizeCorner);
+};
+
+
+///////////////////////////////////////////////////////////////////////////////
// BrowserView, public:
// static
@@ -119,7 +173,7 @@ void BrowserView::SetShowState(int state) {
}
BrowserView::BrowserView(Browser* browser)
- : ClientView(NULL, NULL),
+ : views::ClientView(NULL, NULL),
frame_(NULL),
browser_(browser),
active_bookmark_bar_(NULL),
@@ -177,7 +231,7 @@ void BrowserView::WindowMoved() {
// Cancel any tabstrip animations, some of them may be invalidated by the
// window being repositioned.
// Comment out for one cycle to see if this fixes dist tests.
- //tabstrip_->DestroyDragController();
+ // tabstrip_->DestroyDragController();
status_bubble_->Reposition();
@@ -491,7 +545,7 @@ gfx::Rect BrowserView::GetNormalBounds() const {
return gfx::Rect(wp.rcNormalPosition);
}
-bool BrowserView::IsMaximized() {
+bool BrowserView::IsMaximized() const {
return frame_->GetWindow()->IsMaximized();
}
@@ -535,6 +589,32 @@ bool BrowserView::IsBookmarkBarVisible() const {
return bookmark_bar_view_->GetPreferredSize().height() > 1;
}
+gfx::Rect BrowserView::GetRootWindowResizerRect() const {
+ // There is no resize corner when we are maximized
+ if (IsMaximized())
+ return gfx::Rect();
+
+ // We don't specify a resize corner size if we have a bottom shelf either.
+ // This is because we take care of drawing the resize corner on top of that
+ // shelf, so we don't want others to do it for us in this case.
+ // Currently, the only visible bottom shelf is the download shelf.
+ // Other tests should be added here if we add more bottom shelves.
+ TabContents* current_tab = browser_->GetSelectedTabContents();
+ if (current_tab && current_tab->IsDownloadShelfVisible()) {
+ DownloadShelfView* download_shelf = current_tab->GetDownloadShelfView();
+ if (download_shelf && download_shelf->IsShowing())
+ return gfx::Rect();
+ }
+
+ gfx::Rect client_rect = contents_container_->bounds();
+ gfx::Size resize_corner_size = ResizeCorner::GetSize();
+ int x = client_rect.width() - resize_corner_size.width();
+ if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT)
+ x = 0;
+ return gfx::Rect(x, client_rect.height() - resize_corner_size.height(),
+ resize_corner_size.width(), resize_corner_size.height());
+}
+
void BrowserView::ToggleBookmarkBar() {
BookmarkBarView::ToggleWhenVisible(browser_->profile());
}
@@ -887,6 +967,24 @@ int BrowserView::NonClientHitTest(const gfx::Point& point) {
// area of the window. So we need to treat hit-tests in these regions as
// hit-tests of the titlebar.
+ // There is not resize corner when we are maximised
+ if (!IsMaximized()) {
+ CRect client_rect;
+ ::GetClientRect(frame_->GetWindow()->GetHWND(), &client_rect);
+ gfx::Size resize_corner_size = ResizeCorner::GetSize();
+ gfx::Rect resize_corner_rect(client_rect.right - resize_corner_size.width(),
+ client_rect.bottom - resize_corner_size.height(),
+ resize_corner_size.width(), resize_corner_size.height());
+ bool rtl_dir = (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT);
+ if (rtl_dir)
+ resize_corner_rect.set_x(0);
+ if (resize_corner_rect.Contains(point)) {
+ if (rtl_dir)
+ return HTBOTTOMLEFT;
+ return HTBOTTOMRIGHT;
+ }
+ }
+
// Determine if the TabStrip exists and is capable of being clicked on. We
// might be a popup window without a TabStrip, or the TabStrip could be
// animating.
@@ -940,7 +1038,7 @@ int BrowserView::NonClientHitTest(const gfx::Point& point) {
return HTNOWHERE;
// If the point is somewhere else, delegate to the default implementation.
- return ClientView::NonClientHitTest(point);
+ return views::ClientView::NonClientHitTest(point);
}
///////////////////////////////////////////////////////////////////////////////
@@ -1119,7 +1217,7 @@ int BrowserView::LayoutBookmarkAndInfoBars(int top) {
return LayoutBookmarkBar(top);
}
- // If we're showing a regular bookmark bar and it's not below an infobar,
+ // If we're showing a regular bookmark bar and it's not below an infobar,
// make it overlap the toolbar so that the bar items can be drawn higher.
if (active_bookmark_bar_)
top -= bookmark_bar_view_->GetToolbarOverlap();
@@ -1200,8 +1298,11 @@ bool BrowserView::MaybeShowInfoBar(TabContents* contents) {
bool BrowserView::MaybeShowDownloadShelf(TabContents* contents) {
views::View* new_shelf = NULL;
- if (contents && contents->IsDownloadShelfVisible())
+ if (contents && contents->IsDownloadShelfVisible()) {
new_shelf = contents->GetDownloadShelfView();
+ if (new_shelf != active_download_shelf_)
+ new_shelf->AddChildView(new ResizeCorner());
+ }
return UpdateChildViewAndLayout(new_shelf, &active_download_shelf_);
}
diff --git a/chrome/browser/views/frame/browser_view.h b/chrome/browser/views/frame/browser_view.h
index 7be0501..ba247c9 100644
--- a/chrome/browser/views/frame/browser_view.h
+++ b/chrome/browser/views/frame/browser_view.h
@@ -172,13 +172,14 @@ class BrowserView : public BrowserWindow,
virtual void UpdateLoadingAnimations(bool should_animate);
virtual void SetStarredState(bool is_starred);
virtual gfx::Rect GetNormalBounds() const;
- virtual bool IsMaximized();
+ virtual bool IsMaximized() const;
virtual LocationBar* GetLocationBar() const;
virtual void UpdateStopGoState(bool is_loading);
virtual void UpdateToolbar(TabContents* contents, bool should_restore_state);
virtual void FocusToolbar();
virtual void DestroyBrowser();
virtual bool IsBookmarkBarVisible() const;
+ virtual gfx::Rect GetRootWindowResizerRect() const;
virtual void ToggleBookmarkBar();
virtual void ShowAboutChromeDialog();
virtual void ShowBookmarkManager();
@@ -428,4 +429,4 @@ class BrowserView : public BrowserWindow,
DISALLOW_EVIL_CONSTRUCTORS(BrowserView);
};
-#endif // #ifndef CHROME_BROWSER_VIEWS_FRAME_BROWSER_VIEW_H_
+#endif // CHROME_BROWSER_VIEWS_FRAME_BROWSER_VIEW_H_
diff --git a/chrome/chrome.sln b/chrome/chrome.sln
index fc4223d..362efbb 100755
--- a/chrome/chrome.sln
+++ b/chrome/chrome.sln
@@ -1795,6 +1795,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "browser_views", "browser\vi
Release.AspNetCompiler.Debug = "False"
EndProjectSection
ProjectSection(ProjectDependencies) = postProject
+ {0B469837-3D46-484A-AFB3-C5A6C68730B9} = {0B469837-3D46-484A-AFB3-C5A6C68730B9}
{4052059A-D72B-4183-B5C2-9D1B099E9E35} = {4052059A-D72B-4183-B5C2-9D1B099E9E35}
{D9DDAF60-663F-49CC-90DC-3D08CC3D1B28} = {D9DDAF60-663F-49CC-90DC-3D08CC3D1B28}
EndProjectSection
diff --git a/chrome/chrome_kjs.sln b/chrome/chrome_kjs.sln
index 41d28d4..191e663 100644
--- a/chrome/chrome_kjs.sln
+++ b/chrome/chrome_kjs.sln
@@ -1648,6 +1648,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "browser_views", "browser\vi
Release.AspNetCompiler.Debug = "False"
EndProjectSection
ProjectSection(ProjectDependencies) = postProject
+ {0B469837-3D46-484A-AFB3-C5A6C68730B9} = {0B469837-3D46-484A-AFB3-C5A6C68730B9}
{4052059A-D72B-4183-B5C2-9D1B099E9E35} = {4052059A-D72B-4183-B5C2-9D1B099E9E35}
{D9DDAF60-663F-49CC-90DC-3D08CC3D1B28} = {D9DDAF60-663F-49CC-90DC-3D08CC3D1B28}
EndProjectSection
diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h
index e6b401e..d51af0e 100644
--- a/chrome/common/render_messages_internal.h
+++ b/chrome/common/render_messages_internal.h
@@ -70,9 +70,11 @@ IPC_BEGIN_MESSAGES(View)
// Tells the render view to change its size. A ViewHostMsg_PaintRect message
// is generated in response provided new_size is not empty and not equal to
// the view's current size. The generated ViewHostMsg_PaintRect message will
- // have the IS_RESIZE_ACK flag set.
- IPC_MESSAGE_ROUTED1(ViewMsg_Resize,
- gfx::Size /* new_size */)
+ // have the IS_RESIZE_ACK flag set. It also receives the resizer rect so that
+ // we don't have to fetch it every time WebKit asks for it.
+ IPC_MESSAGE_ROUTED2(ViewMsg_Resize,
+ gfx::Size /* new_size */,
+ gfx::Rect /* resizer_rect */)
// Sent to inform the view that it was hidden. This allows it to reduce its
// resource utilization.
diff --git a/chrome/common/slide_animation.h b/chrome/common/slide_animation.h
index f690e48..d998e6c 100644
--- a/chrome/common/slide_animation.h
+++ b/chrome/common/slide_animation.h
@@ -73,7 +73,7 @@ class SlideAnimation : public Animation {
void SetTweenType(TweenType tween_type) { tween_type_ = tween_type; }
double GetCurrentValue() const { return value_current_; }
- bool IsShowing() { return showing_; }
+ bool IsShowing() const { return showing_; }
private:
// Overridden from Animation.
diff --git a/chrome/common/temp_scaffolding_stubs.h b/chrome/common/temp_scaffolding_stubs.h
index 43b1111..0357ae0 100644
--- a/chrome/common/temp_scaffolding_stubs.h
+++ b/chrome/common/temp_scaffolding_stubs.h
@@ -582,6 +582,10 @@ class TabContentsDelegate {
NOTIMPLEMENTED();
return true;
}
+ virtual gfx::Rect GetRootWindowResizerRect() const {
+ return gfx::Rect();
+ }
+
virtual bool IsExternalTabContainer() {
NOTIMPLEMENTED();
return false;
diff --git a/chrome/renderer/render_widget.cc b/chrome/renderer/render_widget.cc
index 83732eb..ad801b0 100644
--- a/chrome/renderer/render_widget.cc
+++ b/chrome/renderer/render_widget.cc
@@ -229,11 +229,15 @@ void RenderWidget::OnClose() {
}
}
-void RenderWidget::OnResize(const gfx::Size& new_size) {
+void RenderWidget::OnResize(const gfx::Size& new_size,
+ const gfx::Rect& resizer_rect) {
// During shutdown we can just ignore this message.
if (!webwidget_)
return;
+ // Remember the rect where the resize corner will be drawn.
+ resizer_rect_ = resizer_rect;
+
// TODO(darin): We should not need to reset this here.
is_hidden_ = false;
needs_repainting_on_restore_ = false;
@@ -694,14 +698,7 @@ void RenderWidget::GetRootWindowRect(WebWidget* webwidget, gfx::Rect* rect) {
void RenderWidget::GetRootWindowResizerRect(WebWidget* webwidget,
gfx::Rect* rect) {
-#if defined(OS_WIN)
- Send(new ViewHostMsg_GetRootWindowResizerRect(routing_id_, host_window_,
- rect));
-#else
- // TODO(port): mac/linux currently choke on this message.
- // See browser/renderer_host/render_message_host.cc.
- NOTIMPLEMENTED();
-#endif
+ *rect = resizer_rect_;
}
void RenderWidget::OnImeSetInputMode(bool is_active) {
diff --git a/chrome/renderer/render_widget.h b/chrome/renderer/render_widget.h
index 8e37b83..9b5f1c4 100644
--- a/chrome/renderer/render_widget.h
+++ b/chrome/renderer/render_widget.h
@@ -120,7 +120,7 @@ class RenderWidget : public IPC::Channel::Listener,
// RenderWidget IPC message handlers
void OnClose();
void OnCreatingNewAck(gfx::NativeViewId parent);
- void OnResize(const gfx::Size& new_size);
+ void OnResize(const gfx::Size& new_size, const gfx::Rect& resizer_rect);
void OnWasHidden();
void OnWasRestored(bool needs_repainting);
void OnPaintRectAck();
@@ -204,6 +204,9 @@ class RenderWidget : public IPC::Channel::Listener,
// scroll event is pending.
gfx::Rect scroll_rect_;
+ // The area that must be reserved for drawing the resize corner.
+ gfx::Rect resizer_rect_;
+
// The scroll delta for a pending scroll event.
gfx::Point scroll_delta_;
@@ -262,4 +265,4 @@ class RenderWidget : public IPC::Channel::Listener,
DISALLOW_EVIL_CONSTRUCTORS(RenderWidget);
};
-#endif // CHROME_RENDERER_RENDER_WIDGET_H__
+#endif // CHROME_RENDERER_RENDER_WIDGET_H__
diff --git a/chrome/test/test_browser_window.h b/chrome/test/test_browser_window.h
index fef495a..0dbff2d 100644
--- a/chrome/test/test_browser_window.h
+++ b/chrome/test/test_browser_window.h
@@ -34,7 +34,7 @@ class TestBrowserWindow : public BrowserWindow {
virtual void UpdateLoadingAnimations(bool should_animate) {}
virtual void SetStarredState(bool is_starred) {}
virtual gfx::Rect GetNormalBounds() const { return gfx::Rect(); }
- virtual bool IsMaximized() { return false; }
+ virtual bool IsMaximized() const { return false; }
virtual LocationBar* GetLocationBar() const {
return const_cast<TestLocationBar*>(&location_bar_);
}
@@ -43,6 +43,7 @@ class TestBrowserWindow : public BrowserWindow {
bool should_restore_state) {}
virtual void FocusToolbar() {}
virtual bool IsBookmarkBarVisible() const { return false; }
+ virtual gfx::Rect GetRootWindowResizerRect() const { return gfx::Rect(); }
virtual void ToggleBookmarkBar() {}
virtual void ShowAboutChromeDialog() {}
virtual void ShowBookmarkManager() {}
diff --git a/chrome/views/resize_corner.cc b/chrome/views/resize_corner.cc
deleted file mode 100644
index 97925ca..0000000
--- a/chrome/views/resize_corner.cc
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/views/resize_corner.h"
-
-#include <vssym32.h>
-
-#include "base/gfx/native_theme.h"
-#include "chrome/common/gfx/chrome_canvas.h"
-
-namespace views {
-
-ResizeCorner::ResizeCorner() {
-}
-
-ResizeCorner::~ResizeCorner() {
-}
-
-void ResizeCorner::Paint(ChromeCanvas* canvas) {
- // Paint the little handle.
- RECT widgetRect = { 0, 0, width(), height() };
- HDC hdc = canvas->beginPlatformPaint();
- gfx::NativeTheme::instance()->PaintStatusGripper(hdc,
- SP_GRIPPER,
- 0,
- 0,
- &widgetRect);
- canvas->endPlatformPaint();
-}
-
-} // namespace views
-
diff --git a/chrome/views/resize_corner.h b/chrome/views/resize_corner.h
deleted file mode 100644
index ed02216..0000000
--- a/chrome/views/resize_corner.h
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_VIEWS_RESIZE_CORNER_H__
-#define CHROME_VIEWS_RESIZE_CORNER_H__
-
-#include "chrome/views/view.h"
-
-namespace views {
-
-// Simple drawing of a resize corner. Has no functionality.
-class ResizeCorner : public View {
- public:
- ResizeCorner();
- virtual ~ResizeCorner();
-
- // View
- virtual void Paint(ChromeCanvas* canvas);
-
- private:
- DISALLOW_EVIL_CONSTRUCTORS(ResizeCorner);
-};
-
-} // namespace views
-
-#endif // CHROME_VIEWS_RESIZE_CORNER_H__
-
diff --git a/chrome/views/views.vcproj b/chrome/views/views.vcproj
index 6d5ce3d..9656303 100644
--- a/chrome/views/views.vcproj
+++ b/chrome/views/views.vcproj
@@ -466,14 +466,6 @@
>
</File>
<File
- RelativePath=".\resize_corner.cc"
- >
- </File>
- <File
- RelativePath=".\resize_corner.h"
- >
- </File>
- <File
RelativePath=".\root_view.cc"
>
</File>