~osomon/oxide/bug1290821

« back to all changes in this revision

Viewing changes to qt/quick/api/oxideqquickwebview.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:
55
55
 
56
56
OxideQQuickWebViewPrivate::OxideQQuickWebViewPrivate(
57
57
    OxideQQuickWebView* view) :
 
58
    oxide::qt::WebViewAdapter(view),
58
59
    context(NULL),
59
60
    navigationHistory(view),
60
61
    popup_menu(NULL),
61
62
    init_props_(new InitData()),
62
 
    load_progress_(0),
63
 
    q_ptr(view) {}
 
63
    load_progress_(0) {}
64
64
 
65
65
OxideQQuickWebViewPrivate::~OxideQQuickWebViewPrivate() {
66
66
}
141
141
                q->width(), q->height()).toRect();
142
142
}
143
143
 
144
 
void OxideQQuickWebViewPrivate::NotifyWebPreferencesDestroyed() {
 
144
void OxideQQuickWebViewPrivate::OnWebPreferencesChanged() {
145
145
  Q_Q(OxideQQuickWebView);
146
146
 
147
 
  qWarning() << "WebPreferences was destroyed whilst still in use";
148
 
  q->setPreferences(NULL);
 
147
  emit q->preferencesChanged();
149
148
}
150
149
 
151
150
void OxideQQuickWebViewPrivate::FrameAdded(
481
480
  }
482
481
 
483
482
  d->setPreferences(prefs);
484
 
  emit preferencesChanged();
 
483
  // We don't emit a signal here, as we get OnWebPreferencesChanged(),
 
484
  // which also happens if our WebPreferences are destroyed
485
485
}
486
486
 
487
487
OxideQQuickNavigationHistory* OxideQQuickWebView::navigationHistory() {