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

Side by Side Diff: chrome/browser/views/shelf_item_dialog.cc

Issue 7344: Convert GetPreferredSize from:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/shelf_item_dialog.h" 5 #include "chrome/browser/views/shelf_item_dialog.h"
6 6
7 #include "base/gfx/png_decoder.h" 7 #include "base/gfx/png_decoder.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "chrome/app/locales/locale_settings.h" 9 #include "chrome/app/locales/locale_settings.h"
10 #include "chrome/app/theme/theme_resources.h" 10 #include "chrome/app/theme/theme_resources.h"
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 } 439 }
440 440
441 void ShelfItemDialog::PerformModelChange() { 441 void ShelfItemDialog::PerformModelChange() {
442 DCHECK(delegate_); 442 DCHECK(delegate_);
443 GURL url(GetInputURL()); 443 GURL url(GetInputURL());
444 const std::wstring title = 444 const std::wstring title =
445 title_field_ ? title_field_->GetText() : std::wstring(); 445 title_field_ ? title_field_->GetText() : std::wstring();
446 delegate_->AddBookmark(this, title, url); 446 delegate_->AddBookmark(this, title, url);
447 } 447 }
448 448
449 void ShelfItemDialog::GetPreferredSize(CSize *out) { 449 gfx::Size ShelfItemDialog::GetPreferredSize() {
450 DCHECK(out); 450 return gfx::Size(ChromeViews::Window::GetLocalizedContentsSize(
451 *out = ChromeViews::Window::GetLocalizedContentsSize(
452 IDS_SHELFITEM_DIALOG_WIDTH_CHARS, 451 IDS_SHELFITEM_DIALOG_WIDTH_CHARS,
453 IDS_SHELFITEM_DIALOG_HEIGHT_LINES).ToSIZE(); 452 IDS_SHELFITEM_DIALOG_HEIGHT_LINES));
454 } 453 }
455 454
456 bool ShelfItemDialog::AcceleratorPressed( 455 bool ShelfItemDialog::AcceleratorPressed(
457 const ChromeViews::Accelerator& accelerator) { 456 const ChromeViews::Accelerator& accelerator) {
458 if (accelerator.GetKeyCode() == VK_ESCAPE) { 457 if (accelerator.GetKeyCode() == VK_ESCAPE) {
459 window()->Close(); 458 window()->Close();
460 } else if (accelerator.GetKeyCode() == VK_RETURN) { 459 } else if (accelerator.GetKeyCode() == VK_RETURN) {
461 ChromeViews::FocusManager* fm = ChromeViews::FocusManager::GetFocusManager( 460 ChromeViews::FocusManager* fm = ChromeViews::FocusManager::GetFocusManager(
462 GetViewContainer()->GetHWND()); 461 GetViewContainer()->GetHWND());
463 if (fm->GetFocusedView() == url_table_) { 462 if (fm->GetFocusedView() == url_table_) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 PerformModelChange(); 503 PerformModelChange();
505 if (window()) 504 if (window())
506 window()->Close(); 505 window()->Close();
507 } 506 }
508 } 507 }
509 508
510 GURL ShelfItemDialog::GetInputURL() const { 509 GURL ShelfItemDialog::GetInputURL() const {
511 return GURL(URLFixerUpper::FixupURL(url_field_->GetText(), L"")); 510 return GURL(URLFixerUpper::FixupURL(url_field_->GetText(), L""));
512 } 511 }
513 512
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698