~osomon/oxide/bug1290821

« back to all changes in this revision

Viewing changes to qt/core/api/internal/oxideqwebpreferences_p.cc

  • Committer: Chris Coulson
  • Date: 2014-02-20 14:42:23 UTC
  • Revision ID: chris.coulson@canonical.com-20140220144223-cm4jsx5sfhm1movd
Implement WebPreferenceObserver, as this will make testing easier. Also, get rid of the default preferences hack and don't lazy initialize the default WebPreferences

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
#include "qt/core/glue/oxide_qt_web_view_adapter.h"
22
22
 
23
 
OxideQWebPreferencesPrivate::OxideQWebPreferencesPrivate() :
 
23
OxideQWebPreferencesPrivate::OxideQWebPreferencesPrivate(
 
24
    OxideQWebPreferences* q) :
 
25
    preferences(q),
24
26
    in_destructor_(false) {}
25
27
 
26
28
OxideQWebPreferencesPrivate::~OxideQWebPreferencesPrivate() {
27
29
  in_destructor_ = true;
28
 
 
29
 
  for (std::set<oxide::qt::WebViewAdapter *>::const_iterator it = views_.begin();
30
 
       it != views_.end(); ++it) {
31
 
    oxide::qt::WebViewAdapter* view = *it;
32
 
    view->NotifyWebPreferencesDestroyed();
33
 
  }
34
 
}
35
 
 
36
 
void OxideQWebPreferencesPrivate::AddWebView(oxide::qt::WebViewAdapter* view) {
37
 
  Q_ASSERT(!in_destructor_);
38
 
  views_.insert(view);
39
 
}
40
 
 
41
 
void OxideQWebPreferencesPrivate::RemoveWebView(
42
 
    oxide::qt::WebViewAdapter* view) {
43
 
  if (in_destructor_) {
44
 
    return;
45
 
  }
46
 
 
47
 
  views_.erase(view);
48
30
}
49
31
 
50
32
// static