| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <stack> | 5 #include <stack> |
| 6 | 6 |
| 7 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_editor_base_controller.h" | 7 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_editor_base_controller.h" |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/mac/bundle_locations.h" | 11 #include "base/mac/bundle_locations.h" |
| 12 #include "base/mac/foundation_util.h" | 12 #include "base/mac/foundation_util.h" |
| 13 #include "base/strings/sys_string_conversions.h" | 13 #include "base/strings/sys_string_conversions.h" |
| 14 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 14 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 15 #include "chrome/browser/bookmarks/managed_bookmark_service_factory.h" | 15 #include "chrome/browser/bookmarks/managed_bookmark_service_factory.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/ui/browser_dialogs.h" | 17 #include "chrome/browser/ui/browser_dialogs.h" |
| 18 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_all_tabs_controller.h" | 18 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_all_tabs_controller.h" |
| 19 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller.h" | 19 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller.h" |
| 20 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_name_folder_controller.h" | 20 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_name_folder_controller.h" |
| 21 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_tree_browser_cell.h" | 21 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_tree_browser_cell.h" |
| 22 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 22 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 23 #include "chrome/grit/generated_resources.h" | 23 #include "chrome/grit/generated_resources.h" |
| 24 #include "components/bookmarks/browser/bookmark_model.h" | 24 #include "components/bookmarks/browser/bookmark_model.h" |
| 25 #include "components/bookmarks/managed/managed_bookmark_service.h" | 25 #include "components/bookmarks/managed/managed_bookmark_service.h" |
| 26 #include "components/strings/grit/components_strings.h" | 26 #include "components/strings/grit/components_strings.h" |
| 27 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
| 28 #include "ui/base/l10n/l10n_util_mac.h" | 28 #include "ui/base/l10n/l10n_util_mac.h" |
| 29 #include "ui/base/material_design/material_design_controller.h" |
| 29 | 30 |
| 30 using bookmarks::BookmarkExpandedStateTracker; | 31 using bookmarks::BookmarkExpandedStateTracker; |
| 31 using bookmarks::BookmarkModel; | 32 using bookmarks::BookmarkModel; |
| 32 using bookmarks::BookmarkNode; | 33 using bookmarks::BookmarkNode; |
| 33 | 34 |
| 34 @interface BookmarkEditorBaseController () | 35 @interface BookmarkEditorBaseController () |
| 35 | 36 |
| 36 // Return the folder tree object for the given path. | 37 // Return the folder tree object for the given path. |
| 37 - (BookmarkFolderInfo*)folderForIndexPath:(NSIndexPath*)path; | 38 - (BookmarkFolderInfo*)folderForIndexPath:(NSIndexPath*)path; |
| 38 | 39 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 68 path:(std::vector<NSUInteger>*)path | 69 path:(std::vector<NSUInteger>*)path |
| 69 root:(id)root; | 70 root:(id)root; |
| 70 @end | 71 @end |
| 71 | 72 |
| 72 // static; implemented for each platform. Update this function for new | 73 // static; implemented for each platform. Update this function for new |
| 73 // classes derived from BookmarkEditorBaseController. | 74 // classes derived from BookmarkEditorBaseController. |
| 74 void BookmarkEditor::Show(gfx::NativeWindow parent_window, | 75 void BookmarkEditor::Show(gfx::NativeWindow parent_window, |
| 75 Profile* profile, | 76 Profile* profile, |
| 76 const EditDetails& details, | 77 const EditDetails& details, |
| 77 Configuration configuration) { | 78 Configuration configuration) { |
| 78 if (chrome::ToolkitViewsDialogsEnabled()) { | 79 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { |
| 79 chrome::ShowBookmarkEditorViews(parent_window, profile, details, | 80 chrome::ShowBookmarkEditorViews(parent_window, profile, details, |
| 80 configuration); | 81 configuration); |
| 81 return; | 82 return; |
| 82 } | 83 } |
| 83 | 84 |
| 84 if (details.type == EditDetails::EXISTING_NODE && | 85 if (details.type == EditDetails::EXISTING_NODE && |
| 85 details.existing_node->is_folder()) { | 86 details.existing_node->is_folder()) { |
| 86 BookmarkNameFolderController* controller = | 87 BookmarkNameFolderController* controller = |
| 87 [[BookmarkNameFolderController alloc] | 88 [[BookmarkNameFolderController alloc] |
| 88 initWithParentWindow:parent_window | 89 initWithParentWindow:parent_window |
| (...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 729 [super dealloc]; | 730 [super dealloc]; |
| 730 } | 731 } |
| 731 | 732 |
| 732 // Implementing isEqual: allows the NSTreeController to preserve the selection | 733 // Implementing isEqual: allows the NSTreeController to preserve the selection |
| 733 // and open/shut state of outline items when the data changes. | 734 // and open/shut state of outline items when the data changes. |
| 734 - (BOOL)isEqual:(id)other { | 735 - (BOOL)isEqual:(id)other { |
| 735 return [other isKindOfClass:[BookmarkFolderInfo class]] && | 736 return [other isKindOfClass:[BookmarkFolderInfo class]] && |
| 736 folderNode_ == [(BookmarkFolderInfo*)other folderNode]; | 737 folderNode_ == [(BookmarkFolderInfo*)other folderNode]; |
| 737 } | 738 } |
| 738 @end | 739 @end |
| OLD | NEW |