diff options
22 files changed, 83 insertions, 111 deletions
diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc index 541c4a9..ba7d54b 100644 --- a/chrome/browser/extensions/extension_host.cc +++ b/chrome/browser/extensions/extension_host.cc @@ -153,7 +153,7 @@ void ExtensionHost::CreateView(Browser* browser) { view_.reset(new ExtensionView(this, browser)); // We own |view_|, so don't auto delete when it's removed from the view // hierarchy. - view_->SetParentOwned(false); + view_->set_parent_owned(false); #elif defined(OS_LINUX) view_.reset(new ExtensionViewGtk(this, browser)); view_->Init(); diff --git a/chrome/browser/first_run_win.cc b/chrome/browser/first_run_win.cc index fc2d8eb..cada11c 100644 --- a/chrome/browser/first_run_win.cc +++ b/chrome/browser/first_run_win.cc @@ -396,7 +396,7 @@ bool OpenFirstRunDialog(Profile* profile, homepage_defined, import_items, dont_import_items)); - first_run_view->SetParentOwned(false); + first_run_view->set_parent_owned(false); views::Window* first_run_ui = views::Window::CreateChromeWindow( NULL, gfx::Rect(), first_run_view.get()); DCHECK(first_run_ui); diff --git a/chrome/browser/views/about_chrome_view.cc b/chrome/browser/views/about_chrome_view.cc index 5215d23..25da360 100755 --- a/chrome/browser/views/about_chrome_view.cc +++ b/chrome/browser/views/about_chrome_view.cc @@ -137,23 +137,23 @@ void AboutChromeView::Init() { // Views we will add to the *parent* of this dialog, since it will display // next to the buttons which we don't draw ourselves. throbber_.reset(new views::Throbber(50, true)); - throbber_->SetParentOwned(false); + throbber_->set_parent_owned(false); throbber_->SetVisible(false); SkBitmap* success_image = rb.GetBitmapNamed(IDR_UPDATE_UPTODATE); success_indicator_.SetImage(*success_image); - success_indicator_.SetParentOwned(false); + success_indicator_.set_parent_owned(false); SkBitmap* update_available_image = rb.GetBitmapNamed(IDR_UPDATE_AVAILABLE); update_available_indicator_.SetImage(*update_available_image); - update_available_indicator_.SetParentOwned(false); + update_available_indicator_.set_parent_owned(false); SkBitmap* timeout_image = rb.GetBitmapNamed(IDR_UPDATE_FAIL); timeout_indicator_.SetImage(*timeout_image); - timeout_indicator_.SetParentOwned(false); + timeout_indicator_.set_parent_owned(false); update_label_.SetVisible(false); - update_label_.SetParentOwned(false); + update_label_.set_parent_owned(false); // Regular view controls we draw by ourself. First, we add the background // image for the dialog. We have two different background bitmaps, one for diff --git a/chrome/browser/views/autocomplete/autocomplete_popup_gtk.cc b/chrome/browser/views/autocomplete/autocomplete_popup_gtk.cc index bffd707..5ea5e39 100644 --- a/chrome/browser/views/autocomplete/autocomplete_popup_gtk.cc +++ b/chrome/browser/views/autocomplete/autocomplete_popup_gtk.cc @@ -48,7 +48,7 @@ void AutocompletePopupGtk::Init(AutocompleteEditView* edit_view, WidgetGtk::Init(gtk_widget_get_parent(edit_view->GetNativeView()), contents_->GetPopupBounds()); // The contents is owned by the LocationBarView. - contents_->SetParentOwned(false); + contents_->set_parent_owned(false); SetContentsView(contents_); edit_view_ = edit_view; diff --git a/chrome/browser/views/autocomplete/autocomplete_popup_win.cc b/chrome/browser/views/autocomplete/autocomplete_popup_win.cc index 6caf2b6..f3737ae 100644 --- a/chrome/browser/views/autocomplete/autocomplete_popup_win.cc +++ b/chrome/browser/views/autocomplete/autocomplete_popup_win.cc @@ -45,7 +45,7 @@ void AutocompletePopupWin::Init(AutocompleteEditView* edit_view, WidgetWin::Init(GetAncestor(edit_view->GetNativeView(), GA_ROOT), contents_->GetPopupBounds()); // The contents is owned by the LocationBarView. - contents_->SetParentOwned(false); + contents_->set_parent_owned(false); SetContentsView(contents_); // When an IME is attached to the rich-edit control, retrieve its window diff --git a/chrome/browser/views/bookmark_editor_view.cc b/chrome/browser/views/bookmark_editor_view.cc index f40e25f..c3f8049b 100644 --- a/chrome/browser/views/bookmark_editor_view.cc +++ b/chrome/browser/views/bookmark_editor_view.cc @@ -260,8 +260,8 @@ void BookmarkEditorView::Init() { DCHECK(bb_model_); bb_model_->AddObserver(this); - url_tf_.SetParentOwned(false); - title_tf_.SetParentOwned(false); + url_tf_.set_parent_owned(false); + title_tf_.set_parent_owned(false); std::wstring title; if (details_.type == EditDetails::EXISTING_NODE) @@ -288,7 +288,7 @@ void BookmarkEditorView::Init() { tree_view_ = new views::TreeView(); new_group_button_.reset(new views::NativeButton( this, l10n_util::GetString(IDS_BOOMARK_EDITOR_NEW_FOLDER_BUTTON))); - new_group_button_->SetParentOwned(false); + new_group_button_->set_parent_owned(false); tree_view_->SetContextMenuController(this); tree_view_->SetRootShown(false); diff --git a/chrome/browser/views/clear_browsing_data.cc b/chrome/browser/views/clear_browsing_data.cc index 322543e..8b94636 100644 --- a/chrome/browser/views/clear_browsing_data.cc +++ b/chrome/browser/views/clear_browsing_data.cc @@ -69,12 +69,12 @@ void ClearBrowsingDataView::Init() { // Views we will add to the *parent* of this dialog, since it will display // next to the buttons which we don't draw ourselves. throbber_.reset(new views::Throbber(50, true)); - throbber_->SetParentOwned(false); + throbber_->set_parent_owned(false); throbber_->SetVisible(false); status_label_.SetText(l10n_util::GetString(IDS_CLEAR_DATA_DELETING)); status_label_.SetVisible(false); - status_label_.SetParentOwned(false); + status_label_.set_parent_owned(false); // Regular view controls we draw by ourself. First, we add the dialog label. delete_all_label_ = new views::Label( diff --git a/chrome/browser/views/extensions/extension_shelf.cc b/chrome/browser/views/extensions/extension_shelf.cc index a586da32..b462128 100644 --- a/chrome/browser/views/extensions/extension_shelf.cc +++ b/chrome/browser/views/extensions/extension_shelf.cc @@ -246,7 +246,7 @@ ExtensionShelf::Toolstrip::Toolstrip(ExtensionShelf* shelf, ALLOW_THIS_IN_INITIALIZER_LIST(timer_factory_(this)) { DCHECK(host->view()); // We're owned by shelf_, not the bubble that we get inserted in and out of. - SetParentOwned(false); + set_parent_owned(false); mole_animation_.reset(new SlideAnimation(this)); diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index 771f65a..ac22274 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -1051,7 +1051,7 @@ bool BrowserView::IsDownloadShelfVisible() const { DownloadShelf* BrowserView::GetDownloadShelf() { if (!download_shelf_.get()) { download_shelf_.reset(new DownloadShelfView(browser_.get(), this)); - download_shelf_->SetParentOwned(false); + download_shelf_->set_parent_owned(false); } return download_shelf_.get(); } @@ -1953,7 +1953,7 @@ bool BrowserView::MaybeShowBookmarkBar(TabContents* contents) { if (!bookmark_bar_view_.get()) { bookmark_bar_view_.reset(new BookmarkBarView(contents->profile(), browser_.get())); - bookmark_bar_view_->SetParentOwned(false); + bookmark_bar_view_->set_parent_owned(false); bookmark_bar_view_->set_background( new BookmarkExtensionBackground(this, bookmark_bar_view_.get(), browser_.get())); diff --git a/chrome/browser/views/fullscreen_exit_bubble.cc b/chrome/browser/views/fullscreen_exit_bubble.cc index 5973e23..3d4f06d 100644 --- a/chrome/browser/views/fullscreen_exit_bubble.cc +++ b/chrome/browser/views/fullscreen_exit_bubble.cc @@ -48,7 +48,7 @@ const int FullscreenExitBubble::FullscreenExitView::kPaddingPixels = 8; FullscreenExitBubble::FullscreenExitView::FullscreenExitView( FullscreenExitBubble* bubble, const std::wstring& accelerator) { - link_.SetParentOwned(false); + link_.set_parent_owned(false); link_.SetText(l10n_util::GetStringF(IDS_EXIT_FULLSCREEN_MODE, accelerator)); link_.SetController(bubble); link_.SetFont(ResourceBundle::GetSharedInstance().GetFont( diff --git a/chrome/browser/views/importing_progress_view.cc b/chrome/browser/views/importing_progress_view.cc index ed58f9c..32b92e5 100644 --- a/chrome/browser/views/importing_progress_view.cc +++ b/chrome/browser/views/importing_progress_view.cc @@ -58,16 +58,16 @@ ImportingProgressView::ImportingProgressView(const std::wstring& source_name, label_cookies_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); // These are scoped pointers, so we don't need the parent to delete them. - state_bookmarks_->SetParentOwned(false); - state_searches_->SetParentOwned(false); - state_passwords_->SetParentOwned(false); - state_history_->SetParentOwned(false); - state_cookies_->SetParentOwned(false); - label_bookmarks_->SetParentOwned(false); - label_searches_->SetParentOwned(false); - label_passwords_->SetParentOwned(false); - label_history_->SetParentOwned(false); - label_cookies_->SetParentOwned(false); + state_bookmarks_->set_parent_owned(false); + state_searches_->set_parent_owned(false); + state_passwords_->set_parent_owned(false); + state_history_->set_parent_owned(false); + state_cookies_->set_parent_owned(false); + label_bookmarks_->set_parent_owned(false); + label_searches_->set_parent_owned(false); + label_passwords_->set_parent_owned(false); + label_history_->set_parent_owned(false); + label_cookies_->set_parent_owned(false); } ImportingProgressView::~ImportingProgressView() { diff --git a/chrome/browser/views/infobars/infobars.cc b/chrome/browser/views/infobars/infobars.cc index be4e0ed..07e2de9 100644 --- a/chrome/browser/views/infobars/infobars.cc +++ b/chrome/browser/views/infobars/infobars.cc @@ -114,7 +114,7 @@ InfoBar::InfoBar(InfoBarDelegate* delegate) close_button_(new views::ImageButton(this))), ALLOW_THIS_IN_INITIALIZER_LIST(delete_factory_(this)) { // We delete ourselves when we're removed from the view hierarchy. - SetParentOwned(false); + set_parent_owned(false); set_background(new InfoBarBackground(delegate->GetInfoBarType())); diff --git a/chrome/browser/views/location_bar_view.cc b/chrome/browser/views/location_bar_view.cc index f159d7e..fe71b89 100644 --- a/chrome/browser/views/location_bar_view.cc +++ b/chrome/browser/views/location_bar_view.cc @@ -213,7 +213,7 @@ void LocationBarView::Init() { AddChildView(&selected_keyword_view_); selected_keyword_view_.SetFont(font_); selected_keyword_view_.SetVisible(false); - selected_keyword_view_.SetParentOwned(false); + selected_keyword_view_.set_parent_owned(false); SkColor dimmed_text = GetColor(false, DEEMPHASIZED_TEXT); @@ -221,21 +221,21 @@ void LocationBarView::Init() { type_to_search_view_.SetVisible(false); type_to_search_view_.SetFont(font_); type_to_search_view_.SetColor(dimmed_text); - type_to_search_view_.SetParentOwned(false); + type_to_search_view_.set_parent_owned(false); AddChildView(&keyword_hint_view_); keyword_hint_view_.SetVisible(false); keyword_hint_view_.SetFont(font_); keyword_hint_view_.SetColor(dimmed_text); - keyword_hint_view_.SetParentOwned(false); + keyword_hint_view_.set_parent_owned(false); AddChildView(&security_image_view_); security_image_view_.SetVisible(false); - security_image_view_.SetParentOwned(false); + security_image_view_.set_parent_owned(false); AddChildView(&info_label_); info_label_.SetVisible(false); - info_label_.SetParentOwned(false); + info_label_.set_parent_owned(false); // Notify us when any ancestor is resized. In this case we want to tell the // AutocompleteEditView to close its popup. @@ -721,7 +721,7 @@ void LocationBarView::RefreshPageActionViews() { new PageActionImageView(this, profile_, page_actions[i], bubble_positioner_)); page_action_views_[i]->SetVisible(false); - page_action_views_[i]->SetParentOwned(false); + page_action_views_[i]->set_parent_owned(false); AddChildView(page_action_views_[i]); } } @@ -833,8 +833,8 @@ LocationBarView::SelectedKeywordView::SelectedKeywordView(Profile* profile) AddChildView(&partial_label_); // Full_label and partial_label are deleted by us, make sure View doesn't // delete them too. - full_label_.SetParentOwned(false); - partial_label_.SetParentOwned(false); + full_label_.set_parent_owned(false); + partial_label_.set_parent_owned(false); full_label_.SetVisible(false); partial_label_.SetVisible(false); full_label_.set_border( diff --git a/chrome/browser/views/notifications/balloon_view.cc b/chrome/browser/views/notifications/balloon_view.cc index 43a8554..48cf346 100644 --- a/chrome/browser/views/notifications/balloon_view.cc +++ b/chrome/browser/views/notifications/balloon_view.cc @@ -92,7 +92,7 @@ BalloonViewImpl::BalloonViewImpl() method_factory_(this) { // This object is not to be deleted by the views hierarchy, // as it is owned by the balloon. - SetParentOwned(false); + set_parent_owned(false); // Load the sprites for the frames. ResourceBundle& rb = ResourceBundle::GetSharedInstance(); diff --git a/chrome/browser/views/options/exceptions_page_view.cc b/chrome/browser/views/options/exceptions_page_view.cc index 5e8ac43..7d60f5e 100644 --- a/chrome/browser/views/options/exceptions_page_view.cc +++ b/chrome/browser/views/options/exceptions_page_view.cc @@ -154,13 +154,13 @@ void ExceptionsPageView::InitControlLayout() { // ExceptionsPageView, private void ExceptionsPageView::SetupButtons() { // Disable all buttons in the first place. - remove_button_.SetParentOwned(false); + remove_button_.set_parent_owned(false); remove_button_.SetEnabled(false); - remove_all_button_.SetParentOwned(false); + remove_all_button_.set_parent_owned(false); remove_all_button_.SetEnabled(false); - show_button_.SetParentOwned(false); + show_button_.set_parent_owned(false); show_button_.SetEnabled(false); show_button_.SetVisible(false); } diff --git a/chrome/browser/views/options/passwords_page_view.cc b/chrome/browser/views/options/passwords_page_view.cc index 739c336a..a8179c2 100644 --- a/chrome/browser/views/options/passwords_page_view.cc +++ b/chrome/browser/views/options/passwords_page_view.cc @@ -301,16 +301,16 @@ void PasswordsPageView::InitControlLayout() { // PasswordsPageView, private void PasswordsPageView::SetupButtonsAndLabels() { // Disable all buttons in the first place. - show_button_.SetParentOwned(false); + show_button_.set_parent_owned(false); show_button_.SetEnabled(false); - remove_button_.SetParentOwned(false); + remove_button_.set_parent_owned(false); remove_button_.SetEnabled(false); - remove_all_button_.SetParentOwned(false); + remove_all_button_.set_parent_owned(false); remove_all_button_.SetEnabled(false); - password_label_.SetParentOwned(false); + password_label_.set_parent_owned(false); } void PasswordsPageView::SetupTable() { diff --git a/chrome/browser/views/tabs/dragged_tab_view.cc b/chrome/browser/views/tabs/dragged_tab_view.cc index 293b47b..d3a9263 100644 --- a/chrome/browser/views/tabs/dragged_tab_view.cc +++ b/chrome/browser/views/tabs/dragged_tab_view.cc @@ -40,7 +40,7 @@ DraggedTabView::DraggedTabView(TabContents* datasource, contents_size_(contents_size), close_animation_(this), tab_width_(0) { - SetParentOwned(false); + set_parent_owned(false); renderer_->UpdateData(datasource, false); diff --git a/views/controls/menu/submenu_view.cc b/views/controls/menu/submenu_view.cc index 3b315ef..b6ca627 100644 --- a/views/controls/menu/submenu_view.cc +++ b/views/controls/menu/submenu_view.cc @@ -34,7 +34,7 @@ SubmenuView::SubmenuView(MenuItemView* parent) scroll_view_container_(NULL) { DCHECK(parent); // We'll delete ourselves, otherwise the ScrollView would delete us on close. - SetParentOwned(false); + set_parent_owned(false); } SubmenuView::~SubmenuView() { @@ -277,7 +277,7 @@ MenuScrollViewContainer* SubmenuView::GetScrollViewContainer() { if (!scroll_view_container_) { scroll_view_container_ = new MenuScrollViewContainer(this); // Otherwise MenuHost would delete us. - scroll_view_container_->SetParentOwned(false); + scroll_view_container_->set_parent_owned(false); } return scroll_view_container_; } diff --git a/views/controls/tabbed_pane/native_tabbed_pane_win.cc b/views/controls/tabbed_pane/native_tabbed_pane_win.cc index 043ce83..48df2e8 100644 --- a/views/controls/tabbed_pane/native_tabbed_pane_win.cc +++ b/views/controls/tabbed_pane/native_tabbed_pane_win.cc @@ -76,7 +76,7 @@ void NativeTabbedPaneWin::AddTabAtIndex(int index, const std::wstring& title, View* contents, bool select_if_first_tab) { DCHECK(index <= static_cast<int>(tab_views_.size())); - contents->SetParentOwned(false); + contents->set_parent_owned(false); tab_views_.insert(tab_views_.begin() + index, contents); tab_titles_.insert(tab_titles_.begin() + index, title); diff --git a/views/view.cc b/views/view.cc index 34ec1c3..839616e 100644 --- a/views/view.cc +++ b/views/view.cc @@ -76,9 +76,8 @@ View::~View() { } #if defined(OS_WIN) - if (accessibility_.get()) { + if (accessibility_.get()) accessibility_->Uninitialize(); - } #endif } @@ -198,8 +197,7 @@ void View::Layout() { } // Lay out contents of child Views - int child_count = GetChildViewCount(); - for (int i = 0; i < child_count; ++i) { + for (int i = 0, count = GetChildViewCount(); i < count; ++i) { View* child = GetChildViewAt(i); child->Layout(); } @@ -210,13 +208,12 @@ LayoutManager* View::GetLayoutManager() const { } void View::SetLayoutManager(LayoutManager* layout_manager) { - if (layout_manager_.get()) { + if (layout_manager_.get()) layout_manager_->Uninstalled(this); - } + layout_manager_.reset(layout_manager); - if (layout_manager_.get()) { + if (layout_manager_.get()) layout_manager_->Installed(this); - } } bool View::UILayoutIsRightToLeft() const { @@ -239,9 +236,8 @@ inline int View::MirroredX() const { } int View::MirroredLeftPointForRect(const gfx::Rect& bounds) const { - if (!UILayoutIsRightToLeft()) { + if (!UILayoutIsRightToLeft()) return bounds.x(); - } return width() - bounds.x() - bounds.width(); } @@ -342,8 +338,7 @@ void View::PaintFocusBorder(gfx::Canvas* canvas) { } void View::PaintChildren(gfx::Canvas* canvas) { - int i, c; - for (i = 0, c = GetChildViewCount(); i < c; ++i) { + for (int i = 0, count = GetChildViewCount(); i < count; ++i) { View* child = GetChildViewAt(i); if (!child) { NOTREACHED() << "Should not have a NULL child View for index in bounds"; @@ -354,9 +349,8 @@ void View::PaintChildren(gfx::Canvas* canvas) { } void View::ProcessPaint(gfx::Canvas* canvas) { - if (!IsVisible()) { + if (!IsVisible()) return; - } // We're going to modify the canvas, save it's state first. canvas->save(); @@ -390,9 +384,9 @@ void View::ProcessPaint(gfx::Canvas* canvas) { // We must undo the canvas mirroring once the View is done painting so that // we don't pass the canvas with the mirrored transform to Views that // didn't request the canvas to be flipped. - if (flip_canvas) { + if (flip_canvas) canvas->restore(); - } + canvas->restore(); PaintChildren(canvas); } @@ -402,9 +396,8 @@ void View::ProcessPaint(gfx::Canvas* canvas) { } void View::PaintNow() { - if (!IsVisible()) { + if (!IsVisible()) return; - } View* view = GetParent(); if (view) @@ -533,9 +526,9 @@ void View::AddChildView(int index, View* v) { child_views_.insert(child_views_.begin() + index, v); v->SetParent(this); - for (View* p = this; p; p = p->GetParent()) { + for (View* p = this; p; p = p->GetParent()) p->ViewHierarchyChangedImpl(false, true, this, v); - } + v->PropagateAddNotifications(this, v); UpdateTooltip(); RootView* root = GetRootView(); @@ -624,22 +617,16 @@ void View::DoRemoveChildView(View* a_view, } void View::PropagateRemoveNotifications(View* parent) { - int i, c; - for (i = 0, c = GetChildViewCount(); i < c; ++i) { + for (int i = 0, count = GetChildViewCount(); i < count; ++i) GetChildViewAt(i)->PropagateRemoveNotifications(parent); - } - View *t; - for (t = this; t; t = t->GetParent()) { - t->ViewHierarchyChangedImpl(true, false, parent, this); - } + for (View* v = this; v; v = v->GetParent()) + v->ViewHierarchyChangedImpl(true, false, parent, this); } void View::PropagateAddNotifications(View* parent, View* child) { - int i, c; - for (i = 0, c = GetChildViewCount(); i < c; ++i) { + for (int i = 0, count = GetChildViewCount(); i < count; ++i) GetChildViewAt(i)->PropagateAddNotifications(parent, child); - } ViewHierarchyChangedImpl(true, true, parent, child); } @@ -695,10 +682,8 @@ void View::ViewHierarchyChangedImpl(bool register_accelerators, } void View::PropagateVisibilityNotifications(View* start, bool is_visible) { - int i, c; - for (i = 0, c = GetChildViewCount(); i < c; ++i) { + for (int i = 0, count = GetChildViewCount(); i < count; ++i) GetChildViewAt(i)->PropagateVisibilityNotifications(start, is_visible); - } VisibilityChanged(start, is_visible); } @@ -725,7 +710,7 @@ bool View::GetNotifyWhenVisibleBoundsInRootChanges() { View* View::GetViewForPoint(const gfx::Point& point) { // Walk the child Views recursively looking for the View that most // tightly encloses the specified point. - for (int i = GetChildViewCount() - 1 ; i >= 0 ; --i) { + for (int i = GetChildViewCount() - 1; i >= 0; --i) { View* child = GetChildViewAt(i); if (!child->IsVisible()) continue; @@ -758,8 +743,7 @@ View* View::GetViewByID(int id) const { if (id == id_) return const_cast<View*>(this); - int view_count = GetChildViewCount(); - for (int i = 0; i < view_count; ++i) { + for (int i = 0, count = GetChildViewCount(); i < count; ++i) { View* child = GetChildViewAt(i); View* view = child->GetViewByID(id); if (view) @@ -772,8 +756,7 @@ void View::GetViewsWithGroup(int group_id, std::vector<View*>* out) { if (group_ == group_id) out->push_back(this); - int view_count = GetChildViewCount(); - for (int i = 0; i < view_count; ++i) + for (int i = 0, count = GetChildViewCount(); i < count; ++i) GetChildViewAt(i)->GetViewsWithGroup(group_id, out); } @@ -805,9 +788,8 @@ int View::GetGroup() const { } void View::SetParent(View* parent) { - if (parent != parent_) { + if (parent != parent_) parent_ = parent; - } } bool View::IsParentOf(View* v) const { @@ -822,7 +804,7 @@ bool View::IsParentOf(View* v) const { } int View::GetChildIndex(View* v) const { - for (int i = 0; i < GetChildViewCount(); i++) { + for (int i = 0, count = GetChildViewCount(); i < count; i++) { if (v == GetChildViewAt(i)) return i; } @@ -913,9 +895,8 @@ void View::PrintViewHierarchyImp(int indent) { LOG(INFO) << buf.str(); std::cout << buf.str() << std::endl; - for (int i = 0; i < GetChildViewCount(); ++i) { + for (int i = 0, count = GetChildViewCount(); i < count; ++i) GetChildViewAt(i)->PrintViewHierarchyImp(indent + 2); - } } @@ -1192,18 +1173,16 @@ void View::OnMouseExited(const MouseEvent& e) { void View::SetMouseHandler(View *new_mouse_handler) { // It is valid for new_mouse_handler to be NULL - if (parent_) { + if (parent_) parent_->SetMouseHandler(new_mouse_handler); - } } void View::SetVisible(bool flag) { if (flag != is_visible_) { // If the tab is currently visible, schedule paint to // refresh parent - if (IsVisible()) { + if (IsVisible()) SchedulePaint(); - } is_visible_ = flag; @@ -1211,9 +1190,8 @@ void View::SetVisible(bool flag) { PropagateVisibilityNotifications(this, flag); // If we are newly visible, schedule paint. - if (IsVisible()) { + if (IsVisible()) SchedulePaint(); - } } } @@ -1259,7 +1237,7 @@ bool View::OnMouseWheel(const MouseWheelEvent& e) { } void View::SetDragController(DragController* drag_controller) { - drag_controller_ = drag_controller; + drag_controller_ = drag_controller; } DragController* View::GetDragController() { @@ -1322,14 +1300,6 @@ void View::UpdateTooltip() { widget->GetTooltipManager()->UpdateTooltip(); } -void View::SetParentOwned(bool f) { - is_parent_owned_ = f; -} - -bool View::IsParentOwned() const { - return is_parent_owned_; -} - std::string View::GetClassName() const { return kViewClassName; } diff --git a/views/view.h b/views/view.h index 8f362f1..d7144f7 100644 --- a/views/view.h +++ b/views/view.h @@ -874,10 +874,12 @@ class View : public AcceleratorTarget { // parent is automatically deleted when the parent is deleted. The default is // true. Set to false if the view is owned by another object and should not // be deleted by its parent. - void SetParentOwned(bool f); + void set_parent_owned(bool is_parent_owned) { + is_parent_owned_ = is_parent_owned; + } - // Return whether a view is owned by its parent. See SetParentOwned() - bool IsParentOwned() const; + // Return whether a view is owned by its parent. + bool IsParentOwned() const { return is_parent_owned_; } // Return the receiving view's class name. A view class is a string which // uniquely identifies the view class. It is intended to be used as a way to diff --git a/views/window/non_client_view.cc b/views/window/non_client_view.cc index 903a774..3fca8bc 100644 --- a/views/window/non_client_view.cc +++ b/views/window/non_client_view.cc @@ -43,7 +43,7 @@ NonClientView::~NonClientView() { void NonClientView::SetFrameView(NonClientFrameView* frame_view) { // See comment in header about ownership. - frame_view->SetParentOwned(false); + frame_view->set_parent_owned(false); if (frame_view_.get()) RemoveChildView(frame_view_.get()); frame_view_.reset(frame_view); |