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

Side by Side Diff: content/shell/browser/shell_views.cc

Issue 102593002: Convert string16 to base::string16 in content. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | « content/shell/browser/shell_network_delegate.cc ('k') | content/shell/browser/shell_win.cc » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/shell/browser/shell.h" 5 #include "content/shell/browser/shell.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "content/public/browser/web_contents.h" 9 #include "content/public/browser/web_contents.h"
10 #include "content/public/browser/web_contents_view.h" 10 #include "content/public/browser/web_contents_view.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 GetWidget()->SetBounds(bounds); 103 GetWidget()->SetBounds(bounds);
104 104
105 // Resizing a widget on chromeos doesn't automatically resize the root, need 105 // Resizing a widget on chromeos doesn't automatically resize the root, need
106 // to explicitly do that. 106 // to explicitly do that.
107 #if defined(OS_CHROMEOS) 107 #if defined(OS_CHROMEOS)
108 GetWidget()->GetNativeWindow()->GetDispatcher()->SetHostSize( 108 GetWidget()->GetNativeWindow()->GetDispatcher()->SetHostSize(
109 bounds.size()); 109 bounds.size());
110 #endif 110 #endif
111 } 111 }
112 112
113 void SetWindowTitle(const string16& title) { title_ = title; } 113 void SetWindowTitle(const base::string16& title) { title_ = title; }
114 void EnableUIControl(UIControl control, bool is_enabled) { 114 void EnableUIControl(UIControl control, bool is_enabled) {
115 if (control == BACK_BUTTON) { 115 if (control == BACK_BUTTON) {
116 back_button_->SetState(is_enabled ? views::CustomButton::STATE_NORMAL 116 back_button_->SetState(is_enabled ? views::CustomButton::STATE_NORMAL
117 : views::CustomButton::STATE_DISABLED); 117 : views::CustomButton::STATE_DISABLED);
118 } else if (control == FORWARD_BUTTON) { 118 } else if (control == FORWARD_BUTTON) {
119 forward_button_->SetState(is_enabled ? views::CustomButton::STATE_NORMAL 119 forward_button_->SetState(is_enabled ? views::CustomButton::STATE_NORMAL
120 : views::CustomButton::STATE_DISABLED); 120 : views::CustomButton::STATE_DISABLED);
121 } else if (control == STOP_BUTTON) { 121 } else if (control == STOP_BUTTON) {
122 stop_button_->SetState(is_enabled ? views::CustomButton::STATE_NORMAL 122 stop_button_->SetState(is_enabled ? views::CustomButton::STATE_NORMAL
123 : views::CustomButton::STATE_DISABLED); 123 : views::CustomButton::STATE_DISABLED);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 // Add web contents view as the second row 208 // Add web contents view as the second row
209 { 209 {
210 layout->StartRow(1, 0); 210 layout->StartRow(1, 0);
211 layout->AddView(contents_view_); 211 layout->AddView(contents_view_);
212 } 212 }
213 213
214 layout->AddPaddingRow(0, 5); 214 layout->AddPaddingRow(0, 5);
215 } 215 }
216 // Overridden from TextfieldController 216 // Overridden from TextfieldController
217 virtual void ContentsChanged(views::Textfield* sender, 217 virtual void ContentsChanged(views::Textfield* sender,
218 const string16& new_contents) OVERRIDE { 218 const base::string16& new_contents) OVERRIDE {
219 } 219 }
220 virtual bool HandleKeyEvent(views::Textfield* sender, 220 virtual bool HandleKeyEvent(views::Textfield* sender,
221 const ui::KeyEvent& key_event) OVERRIDE { 221 const ui::KeyEvent& key_event) OVERRIDE {
222 if (sender == url_entry_ && key_event.key_code() == ui::VKEY_RETURN) { 222 if (sender == url_entry_ && key_event.key_code() == ui::VKEY_RETURN) {
223 std::string text = UTF16ToUTF8(url_entry_->text()); 223 std::string text = UTF16ToUTF8(url_entry_->text());
224 GURL url(text); 224 GURL url(text);
225 if (!url.has_scheme()) { 225 if (!url.has_scheme()) {
226 url = GURL(std::string("http://") + std::string(text)); 226 url = GURL(std::string("http://") + std::string(text));
227 url_entry_->SetText(ASCIIToUTF16(url.spec())); 227 url_entry_->SetText(ASCIIToUTF16(url.spec()));
228 } 228 }
(...skipping 12 matching lines...) Expand all
241 shell_->GoBackOrForward(1); 241 shell_->GoBackOrForward(1);
242 else if (sender == refresh_button_) 242 else if (sender == refresh_button_)
243 shell_->Reload(); 243 shell_->Reload();
244 else if (sender == stop_button_) 244 else if (sender == stop_button_)
245 shell_->Stop(); 245 shell_->Stop();
246 } 246 }
247 247
248 // Overridden from WidgetDelegateView 248 // Overridden from WidgetDelegateView
249 virtual bool CanResize() const OVERRIDE { return true; } 249 virtual bool CanResize() const OVERRIDE { return true; }
250 virtual bool CanMaximize() const OVERRIDE { return true; } 250 virtual bool CanMaximize() const OVERRIDE { return true; }
251 virtual string16 GetWindowTitle() const OVERRIDE { 251 virtual base::string16 GetWindowTitle() const OVERRIDE {
252 return title_; 252 return title_;
253 } 253 }
254 virtual void WindowClosing() OVERRIDE { 254 virtual void WindowClosing() OVERRIDE {
255 if (shell_) { 255 if (shell_) {
256 delete shell_; 256 delete shell_;
257 shell_ = NULL; 257 shell_ = NULL;
258 } 258 }
259 } 259 }
260 virtual View* GetContentsView() OVERRIDE { return this; } 260 virtual View* GetContentsView() OVERRIDE { return this; }
261 261
262 // Overridden from View 262 // Overridden from View
263 virtual void ViewHierarchyChanged( 263 virtual void ViewHierarchyChanged(
264 const ViewHierarchyChangedDetails& details) OVERRIDE { 264 const ViewHierarchyChangedDetails& details) OVERRIDE {
265 if (details.is_add && details.child == this) { 265 if (details.is_add && details.child == this) {
266 InitShellWindow(); 266 InitShellWindow();
267 } 267 }
268 } 268 }
269 269
270 private: 270 private:
271 // Hold a reference of Shell for deleting it when the window is closing 271 // Hold a reference of Shell for deleting it when the window is closing
272 Shell* shell_; 272 Shell* shell_;
273 273
274 // Window title 274 // Window title
275 string16 title_; 275 base::string16 title_;
276 276
277 // Toolbar view contains forward/backward/reload button and URL entry 277 // Toolbar view contains forward/backward/reload button and URL entry
278 View* toolbar_view_; 278 View* toolbar_view_;
279 views::LabelButton* back_button_; 279 views::LabelButton* back_button_;
280 views::LabelButton* forward_button_; 280 views::LabelButton* forward_button_;
281 views::LabelButton* refresh_button_; 281 views::LabelButton* refresh_button_;
282 views::LabelButton* stop_button_; 282 views::LabelButton* stop_button_;
283 views::Textfield* url_entry_; 283 views::Textfield* url_entry_;
284 284
285 // Contents view contains the web contents view 285 // Contents view contains the web contents view
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 delegate_view->SetWebContents(web_contents_.get(), content_size_); 380 delegate_view->SetWebContents(web_contents_.get(), content_size_);
381 } 381 }
382 382
383 void Shell::PlatformResizeSubViews() { 383 void Shell::PlatformResizeSubViews() {
384 } 384 }
385 385
386 void Shell::Close() { 386 void Shell::Close() {
387 window_widget_->CloseNow(); 387 window_widget_->CloseNow();
388 } 388 }
389 389
390 void Shell::PlatformSetTitle(const string16& title) { 390 void Shell::PlatformSetTitle(const base::string16& title) {
391 ShellWindowDelegateView* delegate_view = 391 ShellWindowDelegateView* delegate_view =
392 static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate()); 392 static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate());
393 delegate_view->SetWindowTitle(title); 393 delegate_view->SetWindowTitle(title);
394 window_widget_->UpdateWindowTitle(); 394 window_widget_->UpdateWindowTitle();
395 } 395 }
396 396
397 } // namespace content 397 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/browser/shell_network_delegate.cc ('k') | content/shell/browser/shell_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698