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

Side by Side Diff: chrome/browser/chromeos/input_method/candidate_window.cc

Issue 7741038: Fix a memory leak in the IME candidate window of Chrome OS (2nd try). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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
« no previous file with comments | « no previous file | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/chromeos/input_method/candidate_window.h" 5 #include "chrome/browser/chromeos/input_method/candidate_window.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/message_loop.h"
13 #include "base/observer_list.h" 14 #include "base/observer_list.h"
14 #include "base/string_util.h" 15 #include "base/string_util.h"
15 #include "base/stringprintf.h" 16 #include "base/stringprintf.h"
16 #include "base/utf_string_conversions.h" 17 #include "base/utf_string_conversions.h"
17 #include "chrome/browser/chromeos/input_method/ibus_ui_controller.h" 18 #include "chrome/browser/chromeos/input_method/ibus_ui_controller.h"
18 #include "ui/gfx/canvas.h" 19 #include "ui/gfx/canvas.h"
19 #include "ui/gfx/font.h" 20 #include "ui/gfx/font.h"
20 #include "ui/gfx/screen.h" 21 #include "ui/gfx/screen.h"
21 #include "views/controls/label.h" 22 #include "views/controls/label.h"
22 #include "views/controls/textfield/textfield.h" 23 #include "views/controls/textfield/textfield.h"
(...skipping 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after
1041 } 1042 }
1042 1043
1043 // Update the previous column widths. 1044 // Update the previous column widths.
1044 previous_shortcut_column_width_ = shortcut_column_width; 1045 previous_shortcut_column_width_ = shortcut_column_width;
1045 previous_candidate_column_width_ = candidate_column_width; 1046 previous_candidate_column_width_ = candidate_column_width;
1046 previous_annotation_column_width_ = annotation_column_width; 1047 previous_annotation_column_width_ = annotation_column_width;
1047 1048
1048 // Clear the existing candidate_views if any. 1049 // Clear the existing candidate_views if any.
1049 for (size_t i = 0; i < candidate_views_.size(); ++i) { 1050 for (size_t i = 0; i < candidate_views_.size(); ++i) {
1050 candidate_area_contents->RemoveChildView(candidate_views_[i]); 1051 candidate_area_contents->RemoveChildView(candidate_views_[i]);
1052 // Delete the view after getting out the current message loop iteration.
1053 MessageLoop::current()->DeleteSoon(FROM_HERE, candidate_views_[i]);
1051 } 1054 }
1052 candidate_views_.clear(); 1055 candidate_views_.clear();
1053 1056
1054 views::GridLayout* layout = new views::GridLayout(candidate_area_contents); 1057 views::GridLayout* layout = new views::GridLayout(candidate_area_contents);
1055 // |candidate_area_contents| owns |layout|. 1058 // |candidate_area_contents| owns |layout|.
1056 candidate_area_contents->SetLayoutManager(layout); 1059 candidate_area_contents->SetLayoutManager(layout);
1057 // Initialize the column set. 1060 // Initialize the column set.
1058 views::ColumnSet* column_set = layout->AddColumnSet(0); 1061 views::ColumnSet* column_set = layout->AddColumnSet(0);
1059 if (orientation == InputMethodLookupTable::kVertical) { 1062 if (orientation == InputMethodLookupTable::kVertical) {
1060 column_set->AddColumn(views::GridLayout::FILL, 1063 column_set->AddColumn(views::GridLayout::FILL,
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
1346 CandidateWindowController::~CandidateWindowController() { 1349 CandidateWindowController::~CandidateWindowController() {
1347 delete impl_; 1350 delete impl_;
1348 } 1351 }
1349 1352
1350 bool CandidateWindowController::Init() { 1353 bool CandidateWindowController::Init() {
1351 return impl_->Init(); 1354 return impl_->Init();
1352 } 1355 }
1353 1356
1354 } // namespace input_method 1357 } // namespace input_method
1355 } // namespace chromeos 1358 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698