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

Side by Side Diff: chrome/browser/custom_home_pages_table_model.cc

Issue 6303003: DOMUI Prefs: Implement inline editability for startup pages (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: CSS tweak Created 9 years, 11 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 | chrome/browser/dom_ui/options/browser_options_handler.h » ('j') | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/custom_home_pages_table_model.h" 5 #include "chrome/browser/custom_home_pages_table_model.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "app/table_model_observer.h" 9 #include "app/table_model_observer.h"
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 } 63 }
64 // Complete change, so tell the view to just rebuild itself. 64 // Complete change, so tell the view to just rebuild itself.
65 if (observer_) 65 if (observer_)
66 observer_->OnModelChanged(); 66 observer_->OnModelChanged();
67 } 67 }
68 68
69 void CustomHomePagesTableModel::Add(int index, const GURL& url) { 69 void CustomHomePagesTableModel::Add(int index, const GURL& url) {
70 DCHECK(index >= 0 && index <= RowCount()); 70 DCHECK(index >= 0 && index <= RowCount());
71 entries_.insert(entries_.begin() + static_cast<size_t>(index), Entry()); 71 entries_.insert(entries_.begin() + static_cast<size_t>(index), Entry());
72 entries_[index].url = url; 72 entries_[index].url = url;
73 LoadTitleAndFavIcon(&(entries_[index]));
73 if (observer_) 74 if (observer_)
74 observer_->OnItemsAdded(index, 1); 75 observer_->OnItemsAdded(index, 1);
75 } 76 }
76 77
77 void CustomHomePagesTableModel::Remove(int index) { 78 void CustomHomePagesTableModel::Remove(int index) {
78 DCHECK(index >= 0 && index < RowCount()); 79 DCHECK(index >= 0 && index < RowCount());
79 Entry* entry = &(entries_[index]); 80 Entry* entry = &(entries_[index]);
80 // Cancel any pending load requests now so we don't deref a bogus pointer when 81 // Cancel any pending load requests now so we don't deref a bogus pointer when
81 // we get the loaded notification. 82 // we get the loaded notification.
82 if (entry->title_handle) { 83 if (entry->title_handle) {
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 return NULL; 233 return NULL;
233 } 234 }
234 235
235 string16 CustomHomePagesTableModel::FormattedURL(int row) const { 236 string16 CustomHomePagesTableModel::FormattedURL(int row) const {
236 std::string languages = 237 std::string languages =
237 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages); 238 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages);
238 string16 url = net::FormatUrl(entries_[row].url, languages); 239 string16 url = net::FormatUrl(entries_[row].url, languages);
239 url = base::i18n::GetDisplayStringInLTRDirectionality(url); 240 url = base::i18n::GetDisplayStringInLTRDirectionality(url);
240 return url; 241 return url;
241 } 242 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/dom_ui/options/browser_options_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698