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

Side by Side Diff: chrome/browser/views/frame/browser_view.cc

Issue 465041: Fix download dialog truncation in German locale.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/app/resources/locale_settings_zh-TW.xtb ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/views/frame/browser_view.h" 5 #include "chrome/browser/views/frame/browser_view.h"
6 6
7 #if defined(OS_LINUX) 7 #if defined(OS_LINUX)
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 #endif 9 #endif
10 10
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 #include "chrome/browser/window_sizer.h" 54 #include "chrome/browser/window_sizer.h"
55 #include "chrome/common/chrome_switches.h" 55 #include "chrome/common/chrome_switches.h"
56 #include "chrome/common/native_web_keyboard_event.h" 56 #include "chrome/common/native_web_keyboard_event.h"
57 #include "chrome/common/native_window_notification_source.h" 57 #include "chrome/common/native_window_notification_source.h"
58 #include "chrome/common/notification_service.h" 58 #include "chrome/common/notification_service.h"
59 #include "chrome/common/pref_names.h" 59 #include "chrome/common/pref_names.h"
60 #include "chrome/common/pref_service.h" 60 #include "chrome/common/pref_service.h"
61 #include "grit/app_resources.h" 61 #include "grit/app_resources.h"
62 #include "grit/chromium_strings.h" 62 #include "grit/chromium_strings.h"
63 #include "grit/generated_resources.h" 63 #include "grit/generated_resources.h"
64 #include "grit/locale_settings.h"
64 #include "grit/theme_resources.h" 65 #include "grit/theme_resources.h"
65 #include "grit/webkit_resources.h" 66 #include "grit/webkit_resources.h"
66 #include "views/controls/single_split_view.h" 67 #include "views/controls/single_split_view.h"
67 #include "views/fill_layout.h" 68 #include "views/fill_layout.h"
68 #include "views/focus/external_focus_tracker.h" 69 #include "views/focus/external_focus_tracker.h"
69 #include "views/grid_layout.h" 70 #include "views/grid_layout.h"
70 #include "views/view.h" 71 #include "views/view.h"
71 #include "views/widget/root_view.h" 72 #include "views/widget/root_view.h"
72 #include "views/window/dialog_delegate.h" 73 #include "views/window/dialog_delegate.h"
73 #include "views/window/non_client_view.h" 74 #include "views/window/non_client_view.h"
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 warning_->set_border(views::Border::CreateEmptyBorder(10, 10, 10, 10)); 319 warning_->set_border(views::Border::CreateEmptyBorder(10, 10, 10, 10));
319 layout->StartRow(0, columnset_id); 320 layout->StartRow(0, columnset_id);
320 layout->AddView(warning_); 321 layout->AddView(warning_);
321 322
322 explanation_ = new views::Label(explanation_text); 323 explanation_ = new views::Label(explanation_text);
323 explanation_->SetMultiLine(true); 324 explanation_->SetMultiLine(true);
324 explanation_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 325 explanation_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
325 explanation_->set_border(views::Border::CreateEmptyBorder(10, 10, 10, 10)); 326 explanation_->set_border(views::Border::CreateEmptyBorder(10, 10, 10, 10));
326 layout->StartRow(0, columnset_id); 327 layout->StartRow(0, columnset_id);
327 layout->AddView(explanation_); 328 layout->AddView(explanation_);
329
330 dialog_dimensions_ = views::Window::GetLocalizedContentsSize(
331 IDS_DOWNLOAD_IN_PROGRESS_WIDTH_CHARS,
332 IDS_DOWNLOAD_IN_PROGRESS_MINIMUM_HEIGHT_LINES);
333 const int height =
334 warning_->GetHeightForWidth(dialog_dimensions_.width()) +
335 explanation_->GetHeightForWidth(dialog_dimensions_.width());
336 dialog_dimensions_.set_height(std::max(height,
337 dialog_dimensions_.height()));
328 } 338 }
329 339
330 ~DownloadInProgressConfirmDialogDelegate() { 340 ~DownloadInProgressConfirmDialogDelegate() {
331 } 341 }
332 342
333 // View implementation: 343 // View implementation:
334 virtual gfx::Size GetPreferredSize() { 344 virtual gfx::Size GetPreferredSize() {
335 const int kContentWidth = 400; 345 return dialog_dimensions_;
336 const int height = warning_->GetHeightForWidth(kContentWidth) +
337 explanation_->GetHeightForWidth(kContentWidth);
338 return gfx::Size(kContentWidth, height);
339 } 346 }
340 347
341 // DialogDelegate implementation: 348 // DialogDelegate implementation:
342 virtual int GetDefaultDialogButton() const { 349 virtual int GetDefaultDialogButton() const {
343 return MessageBoxFlags::DIALOGBUTTON_CANCEL; 350 return MessageBoxFlags::DIALOGBUTTON_CANCEL;
344 } 351 }
345 352
346 virtual std::wstring GetDialogButtonLabel( 353 virtual std::wstring GetDialogButtonLabel(
347 MessageBoxFlags::DialogButton button) const { 354 MessageBoxFlags::DialogButton button) const {
348 if (button == MessageBoxFlags::DIALOGBUTTON_OK) 355 if (button == MessageBoxFlags::DIALOGBUTTON_OK)
(...skipping 27 matching lines...) Expand all
376 private: 383 private:
377 Browser* browser_; 384 Browser* browser_;
378 views::Label* warning_; 385 views::Label* warning_;
379 views::Label* explanation_; 386 views::Label* explanation_;
380 387
381 std::wstring ok_button_text_; 388 std::wstring ok_button_text_;
382 std::wstring cancel_button_text_; 389 std::wstring cancel_button_text_;
383 390
384 std::wstring product_name_; 391 std::wstring product_name_;
385 392
393 gfx::Size dialog_dimensions_;
394
386 DISALLOW_COPY_AND_ASSIGN(DownloadInProgressConfirmDialogDelegate); 395 DISALLOW_COPY_AND_ASSIGN(DownloadInProgressConfirmDialogDelegate);
387 }; 396 };
388 397
389 /////////////////////////////////////////////////////////////////////////////// 398 ///////////////////////////////////////////////////////////////////////////////
390 // BrowserView, public: 399 // BrowserView, public:
391 400
392 // static 401 // static
393 void BrowserView::SetShowState(int state) { 402 void BrowserView::SetShowState(int state) {
394 explicit_show_state = state; 403 explicit_show_state = state;
395 } 404 }
(...skipping 1884 matching lines...) Expand 10 before | Expand all | Expand 10 after
2280 2289
2281 // static 2290 // static
2282 FindBar* BrowserWindow::CreateFindBar(Browser* browser) { 2291 FindBar* BrowserWindow::CreateFindBar(Browser* browser) {
2283 return browser::CreateFindBar(static_cast<BrowserView*>(browser->window())); 2292 return browser::CreateFindBar(static_cast<BrowserView*>(browser->window()));
2284 } 2293 }
2285 2294
2286 // static 2295 // static
2287 void BrowserList::AllBrowsersClosed() { 2296 void BrowserList::AllBrowsersClosed() {
2288 views::Window::CloseAllSecondaryWindows(); 2297 views::Window::CloseAllSecondaryWindows();
2289 } 2298 }
OLDNEW
« no previous file with comments | « chrome/app/resources/locale_settings_zh-TW.xtb ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698