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

Side by Side Diff: chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc

Issue 7919028: Revert 101581 - Add --use-more-webui runtime flag to toggle WebUI replacements for native dialogs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 3 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) 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/ui/views/bookmarks/bookmark_bubble_view.h" 5 #include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h"
6 6
7 #include "base/string16.h" 7 #include "base/string16.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/app/chrome_command_ids.h" 10 #include "chrome/app/chrome_command_ids.h"
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 bubble_->set_fade_away_on_close(true); 359 bubble_->set_fade_away_on_close(true);
360 Close(); 360 Close();
361 } 361 }
362 // WARNING: we've most likely been deleted when CloseWindow returns. 362 // WARNING: we've most likely been deleted when CloseWindow returns.
363 } 363 }
364 364
365 void BookmarkBubbleView::ShowEditor() { 365 void BookmarkBubbleView::ShowEditor() {
366 const BookmarkNode* node = 366 const BookmarkNode* node =
367 profile_->GetBookmarkModel()->GetMostRecentlyAddedNodeForURL(url_); 367 profile_->GetBookmarkModel()->GetMostRecentlyAddedNodeForURL(url_);
368 368
369 #if !defined(WEBUI_DIALOGS)
369 #if defined(USE_AURA) 370 #if defined(USE_AURA)
370 NOTIMPLEMENTED(); 371 NOTIMPLEMENTED();
371 gfx::NativeView parent = NULL; 372 gfx::NativeView parent = NULL;
372 #elif defined(OS_WIN) 373 #elif defined(OS_WIN)
373 // Parent the editor to our root ancestor (not the root we're in, as that 374 // Parent the editor to our root ancestor (not the root we're in, as that
374 // is the info bubble and will close shortly). 375 // is the info bubble and will close shortly).
375 HWND parent = GetAncestor(GetWidget()->GetNativeView(), GA_ROOTOWNER); 376 HWND parent = GetAncestor(GetWidget()->GetNativeView(), GA_ROOTOWNER);
376 377
377 // We're about to show the bookmark editor. When the bookmark editor closes 378 // We're about to show the bookmark editor. When the bookmark editor closes
378 // we want the browser to become active. NativeWidgetWin::Hide() does a hide 379 // we want the browser to become active. NativeWidgetWin::Hide() does a hide
379 // in a such way that activation isn't changed, which means when we close 380 // in a such way that activation isn't changed, which means when we close
380 // Windows gets confused as to who it should give active status to. We 381 // Windows gets confused as to who it should give active status to. We
381 // explicitly hide the bookmark bubble window in such a way that activation 382 // explicitly hide the bookmark bubble window in such a way that activation
382 // status changes. That way, when the editor closes, activation is properly 383 // status changes. That way, when the editor closes, activation is properly
383 // restored to the browser. 384 // restored to the browser.
384 ShowWindow(GetWidget()->GetNativeView(), SW_HIDE); 385 ShowWindow(GetWidget()->GetNativeView(), SW_HIDE);
385 #elif defined(TOOLKIT_USES_GTK) 386 #elif defined(TOOLKIT_USES_GTK)
386 gfx::NativeWindow parent = GTK_WINDOW( 387 gfx::NativeWindow parent = GTK_WINDOW(
387 static_cast<views::NativeWidgetGtk*>(GetWidget()->native_widget())-> 388 static_cast<views::NativeWidgetGtk*>(GetWidget()->native_widget())->
388 GetTransientParent()); 389 GetTransientParent());
389 #endif 390 #endif
391 #endif
390 392
391 // Even though we just hid the window, we need to invoke Close to schedule 393 // Even though we just hid the window, we need to invoke Close to schedule
392 // the delete and all that. 394 // the delete and all that.
393 Close(); 395 Close();
394 396
395 if (node) { 397 if (node) {
396 BookmarkEditor::Show(parent, profile_, 398 #if defined(WEBUI_DIALOGS)
397 BookmarkEditor::EditDetails::EditNode(node), 399 Browser* browser = BrowserList::GetLastActiveWithProfile(profile_);
400 DCHECK(browser);
401 browser->OpenBookmarkManagerEditNode(node->id());
402 #else
403 BookmarkEditor::Show(parent, profile_, NULL,
404 BookmarkEditor::EditDetails(node),
398 BookmarkEditor::SHOW_TREE); 405 BookmarkEditor::SHOW_TREE);
406 #endif
399 } 407 }
400 } 408 }
401 409
402 void BookmarkBubbleView::ApplyEdits() { 410 void BookmarkBubbleView::ApplyEdits() {
403 // Set this to make sure we don't attempt to apply edits again. 411 // Set this to make sure we don't attempt to apply edits again.
404 apply_edits_ = false; 412 apply_edits_ = false;
405 413
406 BookmarkModel* model = profile_->GetBookmarkModel(); 414 BookmarkModel* model = profile_->GetBookmarkModel();
407 const BookmarkNode* node = model->GetMostRecentlyAddedNodeForURL(url_); 415 const BookmarkNode* node = model->GetMostRecentlyAddedNodeForURL(url_);
408 if (node) { 416 if (node) {
409 const string16 new_title = title_tf_->text(); 417 const string16 new_title = title_tf_->text();
410 if (new_title != node->GetTitle()) { 418 if (new_title != node->GetTitle()) {
411 model->SetTitle(node, new_title); 419 model->SetTitle(node, new_title);
412 UserMetrics::RecordAction( 420 UserMetrics::RecordAction(
413 UserMetricsAction("BookmarkBubble_ChangeTitleInBubble")); 421 UserMetricsAction("BookmarkBubble_ChangeTitleInBubble"));
414 } 422 }
415 // Last index means 'Choose another folder...' 423 // Last index means 'Choose another folder...'
416 if (parent_combobox_->selected_item() < 424 if (parent_combobox_->selected_item() <
417 parent_model_.GetItemCount() - 1) { 425 parent_model_.GetItemCount() - 1) {
418 const BookmarkNode* new_parent = 426 const BookmarkNode* new_parent =
419 parent_model_.GetNodeAt(parent_combobox_->selected_item()); 427 parent_model_.GetNodeAt(parent_combobox_->selected_item());
420 if (new_parent != node->parent()) { 428 if (new_parent != node->parent()) {
421 UserMetrics::RecordAction( 429 UserMetrics::RecordAction(
422 UserMetricsAction("BookmarkBubble_ChangeParent")); 430 UserMetricsAction("BookmarkBubble_ChangeParent"));
423 model->Move(node, new_parent, new_parent->child_count()); 431 model->Move(node, new_parent, new_parent->child_count());
424 } 432 }
425 } 433 }
426 } 434 }
427 } 435 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698